tags:

views:

214

answers:

2

I want to convert a CVS project to Subversion, using cvs2svn. It has a main trunk (HEAD), with several temporary development branches created from the trunk.

Before we convert it, we'll merge the latest changes from the trunk into all of the dev branches. But they will also have changes that haven't been merged back into the trunk yet.

When I convert the project to SVN, it won't have any of the merge-history properties. So how can I initialize those properties, so I can subsequently merge to and from the branches?

In other words, after the conversion, there will be a number of differences between the trunk and any given branch. The next time I merge from the trunk into the branch, I don't want to see those differences as changes that need to be merged. But when I merge from the branch into the trunk, I do. Is this possible?

UPDATE: I took mhagger's suggestion, and told SVN that the branches had all changes already merged in from the trunk:

svn co [branch URL] .
svn merge --record-only [trunk URL]
svn commit -m ''

This works, so the next time I try to merge from the trunk into a branch, it shows no new changes.

But I still have a problem with --reintegrate merges, from the branch back to the trunk. It ends up showing a lot of "R"eplaced files, meaning that the trunk has a file X, and the branch has a file X, but they're not considered the same file. This makes the merge kind of messy, although it seems to end up with the right results.

I think this happens because of the following sequence of events:

  • Branch was created (in CVS)
  • A file X was added to the trunk (in CVS)
  • X was merged into the branch (also in CVS)
  • Project was converted to Subversion
  • Subversion didn't know that branch/X was copied from trunk/X. So it thinks it's a replacement.

The SVN history looks something like this:

r100: create branch (copied from trunk)
r200: add trunk/X
r300: add branch/X (because of a CVS merge, but it's not a SVN copy)

So, is there a way for me to tell Subversion to ignore the files' ancestry when doing a --reintegrate merge? Or a better way to convert these files?

+1  A: 

As you probably know, cvs2svn does not generate any merge metadata, except for the implicit information about where branches sprouted from. (It cannot, because CVS doesn't record such information.) So, after the conversion, you will have to explicitly tell Subversion about merges that were done under CVS.

The easiest way to do that is by using "svn merge --record-only ...", as described in the Subversion book.

mhagger
A: 

OK, I think I have a workaround for the --reintegrate problem above, in case anyone's interested.

According to this document, if I've merged the latest version of the trunk into the branch, doing a --reintegrate is essentially the same as doing this to the trunk:

svn merge [trunk URL] [branch URL]

But this syntax allows --ignore-ancestry, which --reintegrate doesn't. So I can do:

svn merge --ignore-ancestry [trunk URL] [branch URL]

That shows me the same results as a --reintegrate, without all the "R"eplaced files. The only other difference seems to be the mergeinfo properties. I'm not sure whether these will be correct, so it's probably best to delete the branch afterwards, just like you would after a --reintegrate.

JW