Archive for August 29th, 2007

Merging Subversion Repositories

For a while now I’ve had a number of Subversion repositories that contain more or less related code. They should each, individually, contain less related code than they do, but I find that if I’ve only got a checkout of one of them on some random machine I’m fare more likely to check something into whatever repository I’ve already got checked out than I am to checkout the proper repository. If I later want to move it to the correct repository I lose (or at least scatter all over) any revision history.

Enough of that… for a while I’ve been meaning to merge the repositories together so that even if I don’t have the entire repository checked out and decide to check something in where it shouldn’t be I can later move it within the repository layout and keep the revision history in tact. I’ve figured this should be an easy task to accomplish and now that I’ve finally gotten around to doing it, I was pleasantly surprised to find that it is indeed an easy task to accomplish. Here’s how:

  • shutdown svnserve / block access to the repos / don’t let anyone alter the repos while you’re doing this / whatever
  • from each repos’ parent directory dump each of the repos that you want to merge together into their own dump files using svnadmin dump repos-name > DumpFile-repos-name
  • use svndumptool to merge the repos using a command something like this: svndumptool.py merge -i DumpFile-repos1 -r / /repos1 -i DumpFile-repos2 -r / /repos2 -i DumpFile-repos3 -r / /repos3 -o DumpMerged -d repos1 -d repos2 -d repos3
  • create a new repository somewhere using svnadmin create new-repos
  • load the merged repos into your new repos using svnadmin load DumpMerged
  • Sweet. I love it when things are as simple as they should be… it’s usually a sign of competent designers.

    Add comment August 29th, 2007


    Calendar

    August 2007
    M T W T F S S
    « Jul   Sep »
     12345
    6789101112
    13141516171819
    20212223242526
    2728293031  

    Posts by Month

    Posts by Category

    Ohloh profile for Daryl C. W. O'Shea

    LinkedIn

    Apache SpamAssassin