views:

896

answers:

7

I am converting from existing CVS repository to SVN repository. CVS repository has few brances and I'd like to rename branches while converting.

Wanted conversion is like this:

CVS branch         SVN branch
HEAD       ->      branches/branchX
branchA    ->      trunk
branchB    ->      branches/branchB
branchC    ->      branches/branchC

That is, CVS HEAD becomes a normal branch and CVS branchA becomes SVN trunk.

Both CVS and SVN repositories will be on same linux machine.

How could this be done?

Also conversion where CVS branchA becomes SVN trunk and all other CVS branches are ignored might be enough.

+1  A: 

Subversion branches are directories, so you could just move the branches after the import has finished and no history will be lost.

Ted Percival
+5  A: 

It's been a while since I've done a CVS -> SVN conversion, and probably even longer since I did one with a nontrivial branch structure. Since SVN can move around directory trees fairly easily, you could do the whole conversion first, then sort out the trunk/branches structure entirely within SVN later.

If you do get to that point and are moving around whole directory trees within SVN, it's probably best if you commit after every tree rename/move step. Just something to keep in mind.

Greg Hewgill
A: 

I am especially interested in preserving commit history. If I rename and move branches around in SVN after the conversion, will the history be preserved?

Juha Syrjälä
+8  A: 
I am especially interested in preserving commit history. If I rename and move branches around in SVN after the conversion, will the history be preserved?

Yes. Subversion also keeps track of changes to the directory structure, and all version history is preserved even if a file is moved in the tree.

I recommend converting the repository with cvs2svn, including branches and tags. Once the repository is in Subversion you can move the branches and tags around as you wish. This also keeps the history of the actual tags and branches being renamed, which may be interesting in a historical context later.

Anders Sandvig
I'm using cvs2svn, but I want only to convert specific branch and the HEAD, but cvs2svn only have "exclude" function for branches, not "include".So how do I convert the HEAD with one more branch?
Oded
I guess you could dump it all and use then svndumpfilter to filter out whatever you don't want?
Anders Sandvig
I don't think the svndumpfilter removes unmentioned branches.Do you know of any other solution?
Oded
Not sure what you mean by "unmentioned branches", but svndumpfilter has both --include and --exclude parameters. If you tell cvs2svn to use the "/trunk", "/branches" and "/tags" as root folders, extracting the trunk (HEAD from CVS) and a specific branch can be done with 'svndumpfilter --include "/trunk" --include "/branches/<branch-name>" '
Anders Sandvig
+1  A: 

Some additional information to support the accepted answer:

cvs2svn does not allow conversion of from trunk to a branch or the branch to trunk

so moving things once you're converted to svn is the best way to go.

Matthew Jaskula
+1  A: 

It is possible to move the trunk and branch directories after the conversion, but this would require an explicit post-conversion SVN commit that will remain in your SVN history, making history exploration a bit more complicated.

But you can indeed tell cvs2svn to store the trunk and branches to the SVN paths that you want by using the --symbol-hints=symbol-hints.txt command-line option or (if you are using an options file for your conversion) the SymbolHintsFileRule('symbol-hints.txt') symbol strategy rule, where symbol-hints.txt is a file containing lines like the following:

. .trunk. trunk branches/branchX .
. branchX branch trunk .

Please note that some commit messages that are autogenerated by cvs2svn (for example, for the creation of the branch) will mention the original branch name.

mhagger
+1  A: 

Although moving around branches after the conversion is done is possible, it may be better to setup the cvs2svn configuration file to specify exactly the name you want for each of your existing branches. One of the benefits of this is that FishEye will understand the output a lot better.

Ed Thomas