问题
The problem I'm trying to solve is not dissimilar to Subversion out of sync with production code, easiest way to update subversion but somewhat different.
I converted a (Java) project from CVS to SVN (using cvs2svn, retaining full history) - say at version 1.00
Development on version 2.00 continued with the code in SVN.
Meanwhile, some fixes were done in CVS (as the dev tool setup was different.)
Now, what I need to do is effectively re-import part of the project from CVS.
If I had
cvs:project/module1 (version 1.00)
/module2 (version 1.10)
and
svn:project/trunk/module1 (version 2.xx)
/module2 (Version 1.00)
Is there a way of just re-importing module2 from CVS and retain full history?
I've run cvs2svn again on the CVS repository, and was going to load that into SVN as another project, and then do a baseless merge - but I'm not sure if that is such a great idea.
I will be maintaining version 1.xx in SVN going forward.
回答1:
You could convert the current CVS repo into a new dummy SVN repo. Using that, you could cherry-pick revisions to dump and replay those dumps back to the real SVN repo. (I have no idea how this would deal with the case where the same file was changed both in the real SVN and in the CVS/dummy SVN. You might want to avoid finding out about that by replaying the cherry-picked dumps to a specific branch.)
There might be better ways, though, and this might not work at all. I have only ever converted one CVS repo into a SVN repo and that was a pain-in-one-go task. So take this with a lot of salt and dry-run it on a copy first.
回答2:
Since I am going to maintain version 1.xx in SVN as well, and I know at what point the code diverged, I should be able to only merge the changelists created after the migration to SVN. This looks like it will keep things tidiest.
I'm experimenting with that at the moment.
回答3:
From the version numbers that you quote, it looks like all of the post-conversion commits on module1 were in Subversion and all of the post-conversion commits on module2 were in CVS. If that is the case, you might try the following:
Convert the entire CVS project again, using the same cvs2svn options as before. If you are lucky, r0:rN (where N is some number) of the resulting Subversion repository will agree with the overlapping part of the Subversion repository resulting from the first conversion. In this case, you should be able to "svnadmin dump --incremental -rN:HEAD" from the new Subversion repository and "svnadmin load" it on top of the old Subversion repository. The commits in the combined repository will not be in chronological order, but that is a minor annoyance (and could possibly be fixed using some other tools at the expense of renumbering the Subversion commits).
(It is not necessarily the case that the overlapping parts of the Subversion repositories will be identical; cvs2svn uses some heuristics to deduce changesets and their deductions could differ because of other changes. But as long as there are identifiable "1.00" revisions in each repository with identical contents, then I think the procedure should work.)
Make backups before you try this!
来源:https://stackoverflow.com/questions/3985485/re-importing-from-cvs-into-subversion