77

Is it possible to create a patch (diff files) for all files that were affected during a commit AFTER the commit? These files would have same version number and I need the diff of each file from their prior version.

Ihor Patsian
  • 1,288
  • 2
  • 15
  • 25
septerr
  • 6,445
  • 9
  • 50
  • 73

4 Answers4

66

If you know commit number, then use

svn diff -c N path

Where N is commit number and path is path to your working copy.

Mikhail Vladimirov
  • 13,572
  • 1
  • 38
  • 40
  • 2
    I did `svn help diff` and it told me about `svn diff --old=OLD-URL[@OLDREV] --new=NEW-URL[@NEWREV]` which can also compare two revisions. – Lee Meador Feb 22 '13 at 19:29
  • 1
    Might not work straight away if diff-tool has been set in subversion configs. You might want to add `--diff-cmd diff` to this call. – cprn Mar 19 '18 at 10:03
  • Also, you need to specify a path (or multiple paths) to only include selected files. Otherwise your patch will include the entire changeset. – cprn Mar 19 '18 at 10:05
57

Alternative, when using windows + tortoiseSVN :Go to your sourcecode directory, rightclick on the directory (to open the tortoise context-menu) and select "Show Log", select both revisions (ctrl-click) and then right-click and select "Show differences as unified diff" from the context menu. A window will pop up showing the differences, which you can then save as a patch.

Update: Holding Shift, when clicking on "show differences as unified diff" makes a dialog pop up where you can select the diff options (ignore eol changes, ignore whitespace changes, ignore all whitespaces). This is useful if e.g. the line-endings changed between versions (the entire file would otherwise show up as 'changed')

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
kalmiya
  • 2,988
  • 30
  • 38
48

If you know the revision numbers (e.g. 123 and 124) you can use:

svn diff -r123:124 path/to/my_project_folder > ~/my_project_changes_123_124.patch

See also https://stackoverflow.com/a/25283101/1127583

Community
  • 1
  • 1
batigolix
  • 1,674
  • 18
  • 20
3

Though already answered simple version is as below,

1, Source Code Location > Tortoize SVN > show log 
2, Select the revision which has your commit
3, Right Click > select > Show changes as unified diff
4, Pop up with differences of all files in that commit come
5, Copy the entire content and create a new file with the extension of .patch

I referred from below link https://groups.google.com/forum/#!topic/tortoisesvn/xV-hemaFdFU

sunleo
  • 10,589
  • 35
  • 116
  • 196