13

We use subversion and during every check-in, a script creates a patch file with all the diff. Now for the same issue/defect there could be multiple check-ins and we end up with multiple patch files. Now to see consolidated changes for an issue all the patch files have to be merged. Is there a way to do that?

Or another way to solve the same problem is: Is there a way in subversion to get the combined diff of all changes done as part of a particular comment? Eg:

Checked in with comment: "123: first changes"
Checked in with comment: "123: second set of changes"
Checked in with comment: "123: third changes"..

Is there a way to get a combined diff of all change that happened whose comment has prefix 123?

amit
  • 10,612
  • 11
  • 61
  • 60
  • Possible duplicate of [Seeing a combined diff of many commits in subversion?](https://stackoverflow.com/questions/466195/seeing-a-combined-diff-of-many-commits-in-subversion) –  Aug 11 '18 at 04:13
  • Did the changes affect unique files? Or did it affect the same source file multiple times? – jww Dec 30 '18 at 02:27

2 Answers2

15

combinediff from patchutils can combine the diffs for you.

(Shamelessly borrowed from this previous SO question.)

Community
  • 1
  • 1
Amber
  • 507,862
  • 82
  • 626
  • 550
  • 1
    Combinediff only works if the second diff's context lines remain valid *after* the first diff is applied. Thus, if both diffs are against the same baseline, and they touch adjacent lines, then some changes will be rejected. – Pr0methean May 12 '16 at 07:05
  • How to use combinediff, Can we use it on windows ? – ashish Apr 12 '17 at 12:00
  • 1
    Download the latest version from http://cyberelk.net/tim/data/patchutils/stable/, extract, `./configure && make && make install`, then you can run `combinediff patch1 patch2`. – erwaman Sep 06 '17 at 22:24
3

Make a new branch starting from the revision just before the first changeset. In the new branch, merge each changeset of the issue, in order. Take a diff between the start of the new branch and the final result.

(If you do issue-based branching, you'd get the above situation automatically).

Mercurial has a nice extension for handling collections of patches, namely the mq exension. That, in turn, is based on quilt (http://savannah.nongnu.org/projects/quilt), a system designed to stack patches onto each other.

albert
  • 31
  • 1