A while back, we moved our Subversion reposito开发者_如何学Gory to a new server ("B"), expecting the old one ("A") to be retired.
Well, server/repository A never actually got retired, and unbeknownst to me, one of the many projects under source control never got its working copy references updated. In other words, all of the changes for that project (and that project alone) have been getting committed to the old server.
There have been no updates whatsoever to that particular project on the new server, so there is no chance of any conflict in the actual source. But, obviously, the revision numbers are going to be inconsistent.
Is it possible to merge the changes that were committed to repository A into repository B?
Essentially what I'm asking for is similar to the question, How to combine two branches from two different repositories into a single repository? Except that this is for Subversion, not git, and there isn't actually any branch, just one set of changes that were all committed to the trunk (in the wrong repository).
I don't need continuous synchronization, this is just a one-time operation before the old repository is finally retired for real. And I would prefer to bring over the entire revision history for the project in question, i.e. not just commit the newest version as one massive revision.
Just in case the question's not totally clear, here's a visual:
Repository A
Project X: Rev 1 -> Rev 2 -> Rev 3
Project Y: Rev 4 -> Rev 5 -> Rev 6
Repository B:
Project X: Rev 1 -> Rev 2 -> Rev 3 -> Rev 4 -> Rev 5 -> Rev 6
| | |
Expected outcome for Repository A: v v v
Project X: Rev 1 -> Rev 2 -> Rev 3 -> Rev 7 -> Rev 8 -> Rev 9
Project Y: Rev 4 -> Rev 5 -> Rev 6
I just want to copy over all of the revisions for one part of A's tree (and only that part) to B's repository, and leave everything else alone. I'm OK with X's revisions looking like new revisions on B, if necessary.
Solutions?
You can use svnadmin dump
to get the dump of the whole repository and then use svndumpfilter
to produce only a dump of certain repository path. And then import resulted file into your new repository using svnadmin load
.
Here is some example: http://daveharris.wordpress.com/2008/08/05/svn-dump-parts-of-a-repository/
As long as the changes in the two repositories truly don't overlap, you can do something like:
svnadmin dump --incremental -r4:6 /repository/B | svnadmin load /repository/A
to create revisions 7, 8 and 9 in repository A, preserving authors, timestamps, etc.
The --incremental
ensures that the dumped changes are relative to revision 3, which should match what's already in repository A.
(To be on the safe side, I would test this with a throwaway copy of repository A first.)
精彩评论