Best practice tools and techniques for merging derived code snapshot with updated upstream code?

The situation is this: it is necessary to combine the changes from the base code base of the upstream stream (from V1 to V2) into a third code base S1, which is a derivative / branched from V1, to create a new code base S2.

We have access to version control for logs and revisions between V1 and V2 and source V1, V2 and source S1. However, S1 is not provided with a version control and history repository: this cannot be considered as a merger between a branch and a developed trunk, given that the intermediate changes coming to S from V1 are not known individually.

The situation is that we are therefore doing an incremental three-way merger to bring about S2, and the changes received in S1 are updated to work on the basis of V2. (Our evolving V2 is naturally under version control)

I found WinMerge useful in identifying files that are simply different / missing / added between directory structures, and p4merge as a good merge tool with three file-level methods.

What tools and techniques do you offer? It is worth noting that the sizes of the base codes are large, the number of intermediate revisions between V1 and V2 is large, and the size of the changes between V1 and S is also large.

+4
source share
5 answers

Personally, although probably not as fantastic as the aforementioned clone detector, I would start by using diff -u S1 V1 >/tmp/diffs.patch , which should tell you what has been changed in S1. I suspect that a high percentage of differences can be merged on V2 with patch -p0 </tmp/diffs.patch . Any of it cannot be corrected as much as possible, and rejected changes will remain for merging hands.

This should process all the "light" parts in a few minutes. You can try to run it and then delete some more complex files from the .patch file, which you will do all the manual merge with the three-way merge.

If the changes are too extensive (massive refactoring or moving a large amount of code from file to file), you may need to use tools like the aforementioned Ira.

+1
source

What you want to know is the delta between V2 and S1 and where they are.

Winmerge tells you that the files are exactly the same, or if they are missing or different. If it is different, it will not tell you what they have in common, if something, which is the basis for the merger.

I would use (our) clone detector through V2 and S to find out what they had in common when detailing language structures. Code blocks that are clones from V2 to S in the same file are, in a sense, "already combined" ; where there are V2 clones in another file in S, there was probably a code move. Where parameterizable differences exist, a clone detector (at least ours) will be able to tell you what parameters (β€œediting”) are there, and you can decide how to combine them. Where the code is very different, the clone detector will not say anything, but you can get this list by subtracting the files, which, according to the clone detectors, are mainly clones, from those that Winmerge says are different. These very different files are likely to be difficult to merge.

For files that are basically clones of each other, you can use our Smart Differencer to tell you how a V1 file could be modified to produce S; that will provide small resizing information.

0
source

If V is not in a good VCS, he can pay to import V into a new VCS to run. Then create a branch in V1 and import each old copy of S1 that you can find from backups, old build trees, working copies, etc. Create the greatest possible story from V1 to S1 in VCS. If someone did a radical reformatting, then one could normalize this by applying the same tool to the revision of the V2 branch.

Then use the merge tool and make your way through conflicts. If there is a lot (and probably will), you may want to gradually merge in the history stages V1..S1 and V1..S2 so that you can do the intermediate work.

0
source

You must use Git to merge. Checkout S1, then Git merge v2.

If S1 has a lot of changes between it and V1, you can be sure that renames, etc. will cause the least amount of conflict. Alternatively, you can reinstall (replay changes) from the v1 to v2 range on top of s1 or from the v1 to s1 range on top of v2 - it depends on what you want to achieve. This is not a 3-dimensional merger.

how you get v1..v2 and v1..s1 history in git is up to you. If the migration tool does not exist, the export script in each revision should do this. Then simply pass your results on top of S1 as S2 to the SCM that you are using.

Hope this helps,

You can find me on the # git irc channel if you want my help or a bunch of others to be there, which are very good for merging things.

0
source

I really recommend Beyond Compare . It has a clean graphical interface, excellent comparison algorithms, comparison of three files, comparison of directory structures and much more.

0
source

All Articles