15

So in SVN you can do things like:

svn merge -r555:558
svn diff -c551

but (as far as I know) there is no way to do:

svn merge -r555:558, 592:594
svn diff -c551, 557, 563

For merges you can always just do several commands in sequence:

svn merge -r555:558
svn merge -r592:594

but for diffs doing that will just result in multiple diffs (and it's a little sub-optimal for merges too, as you can get conflicts from things that might just be removed in later revisions).

So, my question is ... is there any way, using either SVN itself or SVN combined with Linux commands, to do a true, no-sequential, multi-revision diff and/or merge?

machineghost
  • 33,529
  • 30
  • 159
  • 234
  • I should add that the reason I'm interested in this is that we have our version control system tied to our bug tracking system. A given bug might have several (non-sequential) revisions in its fix, so it would be nice if we could: A) diff all of those revisions at once, for peer review B) merge all of those revisions at once, for moving fixes in to our live branch – machineghost Apr 22 '10 at 17:14

1 Answers1

20

You can merge multiple revisions in one command (at least in 1.6):

svn merge -c 551, 557, 563
svn merge -r 555:558 -r 592:594

however svn diff does not seem to support multiple non-sequential revisions.

To get a cumulative patch, you can get the diffs individually and then use combine-diff to merge them together one-by-one. It's not ideal, but you could write a script to automate the process.

Ed Wagner
  • 378
  • 3
  • 7
  • You rock! I had no idea I could pass multiple -r or -c argument, and the combine-diff suggesttion was helpful too. Thanks :-) – machineghost May 25 '10 at 22:04
  • 1
    Note that for me, the command `svn merge -c 551, 557, 563` resulted in a *too many arguments* error, which was resolved by enquoting the list of changes as follows: `svn merge -c "551, 557, 563"` – dave Apr 29 '14 at 20:18
  • 1
    confirmed @dave issue and fix on version 1.7.14 – CodeMonkey Aug 18 '16 at 16:45