Created
October 13, 2011 19:13
-
-
Save keturn/1285207 to your computer and use it in GitHub Desktop.
hg repository diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# diff working copy of two mercurial repositories. | |
# Only include tracked files. | |
# Adapted from http://mercurial.selenic.com/wiki/GenerateDiffBetweenRepositories | |
if [ $# -eq 1 ] ; then | |
SRC=$PWD | |
DEST=$1 | |
elif [ $# -eq 2 ] ; then | |
SRC=$1 | |
DEST=$2 | |
else | |
echo "Wrong number of arguments. Expected" | |
echo "$0 [source] destination" | |
exit 1 | |
fi | |
echo diff from | |
hg --cwd $SRC tip | |
echo | |
echo diff to | |
hg --cwd $DEST tip | |
# Get all the files tracked in either repository. | |
FILES=$((hg --cwd $SRC status -nmarc ; hg --cwd $DEST status -nmarc) | sort | uniq ) | |
for FILE in $FILES; do | |
if [ -f $SRC/$FILE -o -f $DEST/$FILE ] ; then | |
diff -Nu $SRC/$FILE $DEST/$FILE | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment