Skip to content

Instantly share code, notes, and snippets.

@geoff-nixon
Created October 29, 2013 04:19
Show Gist options
  • Save geoff-nixon/7209122 to your computer and use it in GitHub Desktop.
Save geoff-nixon/7209122 to your computer and use it in GitHub Desktop.
Use 'hg diff' to produce subversion style patches.
#!/bin/sh
svnstyle(){ sed -e 's/^diff --git [^[:space:]]*/Index:/' \
-e 's/^Index: b\//Index: /g' -e 's/\+\+\+ b\//+++ /g' -e \
's/--- a\//===================================================================\
--- /g' ;} ## Careful -- preserve the escaped newline on the line above.
DIFFPARAMS='-g --nodates --subrepos'
hg diff $DIFFPARAMS "$@" | svnstyle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment