No announcement yet.

Merge two repositories with dissimilar history

  • Filter
  • Time
  • Show
Clear All
new posts

  • Merge two repositories with dissimilar history


    I'm not 100% sure if this is the correct place to be posting this, feel free to move it or let me know if it's not.

    I've got an SVN repository for a personal project I've been working on, I was away from home for seven months so to continue using it I copied it to an external hard drive and did a checkout on my laptop from that so I'd have a complete copy of the repository while I was away.

    Unfortunately I managed to break the external hard drive I was using part way through my trip, losing all of that revision data. I purchased another, more robust, external drive and created a new repository on that with all the files I had checked out.

    Now that I'm back it would be great if I could merge the original repository I had at home with my new one despite the revision differences. I'm not even sure if this is possible but if it is the new repository should take precedence over the old one.

    If doing this isn't possible then how would you handle a situation like this?

    Thanks for any help,

  • #2
    Just to further what I said it's not even the whole repository that I need to merge, just one branch which exists in both repositories but the newer one has skipped a few revisions because of the repository lose I had.


    • #3
      If you don't need the history, it's a lot easier - just commit your newer working copy to the older repository.

      If you do need the history you'll need to take a dump of the new repository then use svndumpfilter to restore only the folder you need.

      1) svnadmin dump /path/to/repository > repository-name.dmp
      This will give you the full dump of the newer repository.

      2) svndumpfilter include myproject < repository-name.dmp > myproject.dmp
      This will create a separate dumpfile of just the folder you want from the repository dump.

      3) svnadmin load /path/to/myproject-repo < myproject.dmp
      This will load the dumpfile you created in step 2 into your older repository.

      Hope that helps.


      • #4
        The other is that once developer A has committed his changes, when developer B tries to commit the same file subversion will know developer B is a revision behind on that file and enforce a merge of the two files rather than overwriting.