SVN-like merging
Alexis S. L. Carvalho
alexis at cecm.usp.br
Sat May 6 10:09:30 CDT 2006
Thus spake Colin McMillen:
> So: I would find it very useful if you came up with a contrib script
> for doing this, and I would also highly suggest that such a script be
> used by hgmerge, either by default or (more likely) in the event that
> no merge utility is found (or diff+patch fails).
Using something as simple and hacky as this as your hgmerge should be
enough:
"""\
#!/bin/sh
set -e
LOCAL=$1
BASE=$2
OTHER=$3
cp "$LOCAL" "$LOCAL".LOCAL
cp "$BASE" "$LOCAL".BASE
cp "$OTHER" "$LOCAL".OTHER
merge "$LOCAL" "$BASE" "$OTHER" 2> /dev/null
rm -f "$LOCAL".{LOCAL,BASE,OTHER}
"""
If you'd rather change the hgmerge script distributed with Mercurial,
this should be enough:
diff -r 3044a3fdae76 -r a2a3292863fe hgmerge
--- a/hgmerge Mon May 01 19:17:34 2006 +0200
+++ b/hgmerge Sat May 06 12:06:17 2006 -0300
@@ -78,7 +78,9 @@ success() {
failure() {
echo "merge failed" 1>&2
- mv "$BACKUP" "$LOCAL"
+ cp "$BACKUP" "$LOCAL".LOCAL
+ cp "$BASE" "$LOCAL".BASE
+ cp "$OTHER" "$LOCAL".OTHER
cleanup
exit 1
}
(both were tested only very lightly)
Alexis
More information about the Mercurial
mailing list