4

If I have changes, commited in revisions 11, 13 , 17, 20 into a branch, can I create an svn patch like this ?

svn diff -r11:20

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
treefrog
  • 1,027
  • 1
  • 15
  • 30

2 Answers2

2

You can, but don't forget path, which you diffing, canonical 1-st form of svn diff, JFYI, is:

diff [-c M | -r N[:M]] [TARGET[@REV]...]
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • 1
    what about changes made in revision 12 15 16 and 17 ? will they be in the patch too ? – treefrog Nov 29 '12 at 10:10
  • @treefrog - patch collects **only** path-related changes, if mentioned revisions are ouside diff-tree they will be ignored – Lazy Badger Nov 29 '12 at 10:13
  • What if the revision 12, 15, 16 and 17 are in the path but are irrelevant to the patch I want to create? Can we selectively ignore them? – Mukul Gupta May 02 '16 at 15:45
  • @MukulGupta - it *this* case you have to use `-c`'s and enumerate all needed revisions – Lazy Badger May 03 '16 at 05:17
  • 2
    @LazyBadger: But svn can't take multiple `-c` arguments – Mukul Gupta May 03 '16 at 07:28
  • @MukulGupta - wrong. Extraction from `svn help merge` "You can also cherry-pick several revisions and/or revision ranges: `svn merge -c50,54,60 -r65:68 ^/trunk`" – Lazy Badger May 03 '16 at 07:46
  • 3
    @LazyBadger: Ok. Thanks. I had meant using `svn diff` and not `svn merge`. I want to generate a patch from previous commits. I do not want `merge` to generate the patch and apply it. – Mukul Gupta May 03 '16 at 09:29
1

this should be enough :)

svn diff -rFIRSTREVISION:LATESTREVISION pathOfWorkingCopy > /myPatchFile.patch
jorgevasquezang
  • 1,008
  • 1
  • 9
  • 16