How to merge two seperate - yet similar - codebases into one SVN rep?

寵の児 提交于 2019-12-01 18:32:53

Merging the code bases after committing them to svn has the advantage that you have access to their history afterwards: You'll be able to see which parts of the code came from the ".com" version, which from the ".net", and what changes were made in the process of combining the two.

One way to do this:

  1. Import the ".com" code base into a new repository as trunk.
  2. Create a branch from that trunk: svn cp svn://repo/trunk svn://repo/branches/net
  3. Check out the branch, copy in the ".net" code, do svn add and remove as needed so that the branch contains exactly the .net version. Commit that.
  4. Check out the trunk and svn merge ^/branches/net .
  5. Very carefully review the output of svn diff, and edit the trunk checkout so it becomes your grand unified codebase.

How difficult step 5 is will depend very much on the specific code bases.

If you happen to have access to an older "common ancestor" version, from which both of the code bases are derived, then you should check that version in at step 1 instead, and then check in the ".com" version to the trunk before step 4. This enables svn to do an automatic "3-way merge" at step 5, potentially saving you a bunch of manual work.

Whatever way you do it, some manual editing of files will be needed. That goes a lot easier with a good interactive merge tool, such as meld, which is also a great alternative to plain svn diff for step 5 above.

Note that meld has the ability to a) compare entire directory trees and b) compare and edit three versions at once. So you can point it at a a directory containing the ".com" code, one containing the ".net" code, and your working directory to see all three versions side by side.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!