How to combine two separate but identical codes into one SVN frame?

I have

/ var / www / cool_codebase at www.example.com And I have

/ var / www / cool_codebase at www.example.net

Codebases for the same web application running on different servers. There is a certain specialization between codes (client bits and beans, etc.), but not too much. One code base has files that another does not have, and vice versa. Some programming bits are also different.

I uploaded each code base to my localhost, and my question is:

How can I combine these two folders into one folder and then transfer it as one “great unified code base” to my SVN?

Should I put each code base in my own SVN repo and then merge these separate repositories? Or can I combine codebases before SVN - for example, using some linux command - and then pass it to SVN?

Any ideas or help are appreciated.

I must add that the end result will be ONE “large unified code base”, which we can deploy to both www.example.com and www.example.net without hiccups.

(PS. Yes, I understand that no matter what I do, I will have to edit some files and make the programming "generic", etc. I am not opposed to this. I'm just looking for ways to automate or semi-automate all this.)

+4
source share
1 answer

Merging code bases after they are transferred to svn has the advantage that you have access to their history afterwards: you can see which parts of the code came from the .com version, which is from ".NET", and what changes were made to the merging process of these two.

One way to do this:

  • Import the code base ".com" into the new repository as a trunk.
  • Create a branch from this trunk: svn cp svn://repo/trunk svn://repo/branches/net
  • Check the branch, copy ".net" into the code, make svn add and remove as necessary so that the branch contains exactly the version of .net. Lock it.
  • Check the trunk and svn merge ^/branches/net .
  • Review the output of svn diff very carefully and edit the checksum of the trunk so that it becomes your large unified code base.

As a difficult step 5 will depend heavily on specific code bases.

If you have access to an older version of the “common ancestor” from which both code bases are derived, then you should check this version in step 1, and then check the version of “.com” up to the body before step 4. This allows svn to perform automatic "three-way merge" in step 5, which potentially saves you a lot of manual work.

Whatever way you do it, you will need to manually edit the files. This is much simpler with a good interactive merge tool like meld , which is also a great alternative to the simple 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 the same time. Therefore, you can point it to a directory containing the code .com containing the code .net, and your working directory to see all three versions side by side.

+2
source

Source: https://habr.com/ru/post/900897/


All Articles