The scenario is:
On other machine (same working copy, but no changes):
How can I make svn diff produce patch-appliable patch, or cleanly apply patch produced by svn diff in this case? I can't commit. I would like to preserve mergeinfo (because the obvious workaround is to add the file as totally new, without connection to the previous one).
A patch is a file that show the differences between two revisions or between your local repository and the last revision your repository is pointing. In order to apply the patch successfully, you must run the command from the same path where the patch was created.
Use just svn diff'to display local modifications in a working copy. Display the changes made to TARGET s as they are seen in REV between two revisions. TARGET s may be all working copy paths or all URL s.
With subversion, you can specify which diff binary to use, and parameters to pass to it. See the manual on svn diff.
You'd want to produce a regular patch file from a svn diff, so you'd want the svn diff to look like a normal diff. Try this:
svn diff --diff-cmd /usr/bin/diff -x "-i -b" > mypatch ... patch -p0 < mypatch
Proof of concept:
echo "newline" >> README.txt svn diff --diff-cmd /usr/bin/diff -x "-i -b" > mypatch cp README.txt README.txt.patched svn revert README.txt patch -p0 < mypatch diff README.txt README.txt.patched
No difference in the two files after patching.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With