Merge with TAH
authormpm@selenic.com
Sat, 30 Jul 2005 08:35:29 -0800
changeset 808 8f5637f0a0c049132edcb9ecfc91722b3ee79696
parent 788 64d2a558c943c297bcf1abbb50ee8e36c6192b18 (current diff)
parent 807 5e779f96edb0f3e3f84f641484347f1f9de0e3b5 (diff)
child 814 0902ffece4b4021a2ce4dfe95e6309dad37619a7
push id1
push usergszorc@mozilla.com
push dateWed, 18 Mar 2015 16:34:57 +0000
Merge with TAH
.hgignore
MANIFEST.in
hgeditor
hgmerge
mercurial/commands.py
mercurial/hg.py
mercurial/transaction.py
mercurial/util.py
templates/changelogentry-rss.tmpl
templates/filelogentry-rss.tmpl
tests/README
tests/fish-merge
tests/run-tests
tests/test-backwards-remove
tests/test-backwards-remove.out
tests/test-bad-pull
tests/test-bad-pull.out
tests/test-basic
tests/test-basic.out
tests/test-bdiff
tests/test-clone
tests/test-clone-failure
tests/test-clone-failure.out
tests/test-clone.out
tests/test-conflict
tests/test-conflict.out
tests/test-copy
tests/test-copy.out
tests/test-diffdir
tests/test-diffdir.out
tests/test-empty-dir
tests/test-empty-dir.out
tests/test-flags
tests/test-flags.out
tests/test-help
tests/test-help.out
tests/test-hook
tests/test-hook.out
tests/test-hup
tests/test-hup.out
tests/test-merge-revert
tests/test-merge-revert.out
tests/test-merge-revert2
tests/test-merge-revert2.out
tests/test-merge1
tests/test-merge1.out
tests/test-merge2
tests/test-merge2.out
tests/test-merge3
tests/test-merge3.out
tests/test-merge4
tests/test-merge4.out
tests/test-merge5
tests/test-merge5.out
tests/test-merge6
tests/test-merge6.out
tests/test-pull
tests/test-pull.out
tests/test-rawcommit1
tests/test-rawcommit1.out
tests/test-simple-update
tests/test-simple-update.out
tests/test-tag
tests/test-tag.out
tests/test-tags
tests/test-tags.out
tests/test-undo
tests/test-undo.out
tests/test-unrelated-pull
tests/test-unrelated-pull.out
tests/test-up-local-change
tests/test-up-local-change.out
--- a/.hgignore
+++ b/.hgignore
@@ -1,13 +1,14 @@
 \.orig$
 \.rej$
 ~$
 \.so$
 \.pyc$
 \.swp$
+^tests/.*\.err$
 ^build/
 ^dist/
 ^doc/.*\.[0-9]$
 ^MANIFEST$
-^.pc/
+^\.pc/
 ^patches/
 ^mercurial/__version__.py$
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,15 +1,16 @@
 include hg
 recursive-include mercurial *.py
 include hgweb.cgi
 include hgeditor rewrite-log
-include tests/README tests/run-tests tests/test-*[a-z] tests/*.out
+include tests/README tests/run-tests tests/test-*[a-z0-9] tests/*.out
+prune tests/*.err
 include *.txt
-include templates/map templates/map-*[a-z]
+include templates/map templates/map-*[a-z0-9]
 include templates/*.tmpl
-include doc/README doc/*.txt Makefile
+include doc/README doc/*.txt doc/Makefile
 recursive-include contrib *
 include README
 include CONTRIBUTORS
 include COPYING
 include TODO
 include MANIFEST.in
--- a/hgeditor
+++ b/hgeditor
@@ -1,57 +1,67 @@
 #!/bin/sh
 #
 # This is an example of using HGEDITOR to automate the signing of
 # commits and so on.
 
 # change this to one to turn on GPG support
 SIGN=0
 
-T1=""; T2=""
-cleanup_exit() {
-    rm -f "$T1" "$T2"
-    exit $1
-}
-
 # If you want to pass your favourite editor some other parameters
 # only for Mercurial, modify this:
-case "${EDITOR:=vi}" in
+case "${EDITOR}" in
+    "")
+        EDITOR="vi"
+        ;;
     emacs)
         EDITOR="$EDITOR -nw"
         ;;
     gvim|vim)
         EDITOR="$EDITOR -f -o"
         ;;
 esac
 
+
+HGTMP=""
+cleanup_exit() {
+    rm -rf "$HGTMP"
+    exit $1
+}
+
 # Remove temporary files even if we get interrupted
 trap "cleanup_exit 255" TERM KILL INT QUIT ABRT
-T1=`mktemp`; T2=`mktemp`
+
+HGTMP="${TMPDIR-/tmp}/hgeditor.$RANDOM.$RANDOM.$RANDOM.$$"
+(umask 077 && mkdir "$HGTMP") || {
+    echo "Could not create temporary directory! Exiting." 1>&2
+    exit 1
+}
+
 (
     cd "`hg root`"
     grep '^HG: changed' "$1" | cut -b 13- | while read changed; do
-        hg diff "$changed" >> "$T2"
+        hg diff "$changed" >> "$HGTMP/diff"
     done
 )
 
-echo > "$T1"
+echo > "$HGTMP/msg"
 if [ "$SIGN" == "1" ]; then
     MANIFEST=`grep '^HG: manifest hash' "$1" | cut -b 19-`
-    echo -e "\nmanifest hash: $MANIFEST" >> "$T1"
+    echo -e "\nmanifest hash: $MANIFEST" >> "$HGTMP/msg"
 fi
-grep -vE '^(HG: manifest hash .*)?$' "$1" >> "$T1"
+grep -vE '^(HG: manifest hash .*)?$' "$1" >> "$HGTMP/msg"
 
-CHECKSUM=`md5sum "$T1"`
-$EDITOR "$T1" "$T2" || cleanup_exit $?
+CHECKSUM=`md5sum "$HGTMP/msg"`
+$EDITOR "$HGTMP/msg" "$HGTMP/diff" || cleanup_exit $?
 echo "$CHECKSUM" | md5sum -c >/dev/null 2>&1 && cleanup_exit 13
 
 if [ "$SIGN" == "1" ]; then
     {
-        head -n 1 "$T1"
+        head -n 1 "$HGTMP/msg"
         echo
-        grep -v "^HG:" "$T1" | gpg -t -a -u "${HGUSER}" --clearsign
-    } > "$T2" && mv "$T2" "$1"
+        grep -v "^HG:" "$HGTMP/msg" | gpg -t -a -u "${HGUSER}" --clearsign
+    } > "$HGTMP/msg.gpg" && mv "$HGTMP/msg.gpg" "$1"
 else
-    mv "$T1" "$1"
+    mv "$HGTMP/msg" "$1"
 fi
 
 cleanup_exit $?
--- a/hgmerge
+++ b/hgmerge
@@ -2,82 +2,97 @@
 #
 # hgmerge - default merge helper for Mercurial
 #
 # This tries to find a way to do three-way merge on the current system.
 # The result ought to end up in $1.
 
 set -e # bail out quickly on failure
 
-LOCAL=$1
-BASE=$2
-OTHER=$3
+LOCAL="$1"
+BASE="$2"
+OTHER="$3"
 
-EDITOR="${EDITOR:-vi}"
+if [ -z "$EDITOR" ]; then
+    EDITOR="vi"
+fi
 
 # Back up our file
-cp $LOCAL $LOCAL.orig
+cp "$LOCAL" "$LOCAL.orig"
 
 # Attempt to do a non-interactive merge
-if which merge > /dev/null ; then
-    if merge $LOCAL $BASE $OTHER 2> /dev/null; then
+if type merge > /dev/null ; then
+    if merge "$LOCAL" "$BASE" "$OTHER" 2> /dev/null; then
 	# success!
 	exit 0
     fi
-    cp $LOCAL.orig $LOCAL
-elif which diff3 > /dev/null ; then
-    if diff3 -m $LOCAL.orig $BASE $OTHER > $LOCAL ; then
+    cp "$LOCAL.orig" "$LOCAL"
+elif type diff3 > /dev/null ; then
+    if diff3 -m "$LOCAL.orig" "$BASE" "$OTHER" > "$LOCAL" ; then
 	# success
 	exit 0
     fi
-    cp $LOCAL.orig $LOCAL
+    cp "$LOCAL.orig" "$LOCAL"
 fi
 
 if [ -n "$DISPLAY" ]; then
     # try using kdiff3, which is fairly nice
-    if which kdiff3 > /dev/null ; then
-	if kdiff3 --auto $BASE $LOCAL $OTHER -o $LOCAL ; then
+    if type kdiff3 > /dev/null ; then
+	if kdiff3 --auto "$BASE" "$LOCAL" "$OTHER" -o "$LOCAL" ; then
 	    exit 0
 	else
 	    exit 1
 	fi
     fi
 
     # try using tkdiff, which is a bit less sophisticated
-    if which tkdiff > /dev/null ; then
-	if tkdiff $LOCAL $OTHER -a $BASE -o $LOCAL ; then
+    if type tkdiff > /dev/null ; then
+	if tkdiff "$LOCAL" "$OTHER" -a "$BASE" -o "$LOCAL" ; then
 	    exit 0
 	else
 	    exit 1
 	fi
     fi
 fi
 
 # Attempt to do a merge with $EDITOR
-if which merge > /dev/null ; then
+if type merge > /dev/null ; then
     echo "conflicts detected in $LOCAL"
-    merge $LOCAL $BASE $OTHER 2>/dev/null || $EDITOR $LOCAL
+    merge "$LOCAL" "$BASE" "$OTHER" 2>/dev/null || $EDITOR "$LOCAL"
     exit 0
 fi
 
-if which diff3 > /dev/null ; then
+if type diff3 > /dev/null ; then
     echo "conflicts detected in $LOCAL"
-    diff3 -m $LOCAL.orig $BASE $OTHER > $LOCAL || $EDITOR $LOCAL
+    diff3 -m "$LOCAL.orig" "$BASE" "$OTHER" > "$LOCAL" || $EDITOR "$LOCAL"
     exit 0
 fi
 
+HGTMP=""
+cleanup_exit() {
+    rm -rf "$HGTMP"
+    exit $1
+}
+
 # attempt to manually merge with diff and patch
-if which diff > /dev/null ; then
-    if which patch > /dev/null ; then
-	T=`mktemp`
-	diff -u $BASE $OTHER > $T
-	if patch $LOCAL < $T ; then
-	    exit 0
+if type diff > /dev/null ; then
+    if type patch > /dev/null ; then
+	# Remove temporary files even if we get interrupted
+	trap "cleanup_exit 1" TERM KILL INT QUIT ABRT
+
+	HGTMP="${TMPDIR-/tmp}/hgmerge.$RANDOM.$RANDOM.$RANDOM.$$"
+	(umask 077 && mkdir "$HGTMP") || {
+	    echo "Could not create temporary directory! Exiting." 1>&2
+	    exit 1
+	}
+
+	diff -u "$BASE" "$OTHER" > "$HGTMP/diff"
+	if patch "$LOCAL" < "$HGTMP/diff" ; then
+	    cleanup_exit 0
 	else
-	    $EDITOR $LOCAL $LOCAL.rej
+	    $EDITOR "$LOCAL" "$LOCAL.rej"
 	fi
-	rm $T
-	exit 1
+	cleanup_exit 1
     fi
 fi
 
 echo "hgmerge: unable to find merge, tkdiff, kdiff3, or diff+patch!"
 exit 1
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -522,17 +522,20 @@ def debugcheckstate(ui, repo):
 
 def debugstate(ui, repo):
     """show the contents of the current dirstate"""
     repo.dirstate.read()
     dc = repo.dirstate.map
     keys = dc.keys()
     keys.sort()
     for file_ in keys:
-        ui.write("%c %s\n" % (dc[file_][0], file_))
+        ui.write("%c %3o %10d %s %s\n"
+                 % (dc[file_][0], dc[file_][1] & 0777, dc[file_][2],
+                    time.strftime("%x %X",
+                                  time.localtime(dc[file_][3])), file_))
 
 def debugindex(ui, file_):
     """dump the contents of an index file"""
     r = hg.revlog(hg.opener(""), file_, "")
     ui.write("   rev    offset  length   base linkrev" +
              " p1           p2           nodeid\n")
     for i in range(r.count()):
         e = r.index[i]
--- a/tests/README
+++ b/tests/README
@@ -23,15 +23,11 @@ writing tests:
 
 - changeset hashes will change based on user and date which make
   things like hg history output change
 
   use commit -m "test" -u test -d "0 0"
 
 - diff will show the current time
 
-  use hg diff | sed "s/\(\(---\|+++\) [^ \t]*\)[ \t].*/\1/" to strip
+  use hg diff | sed "s/\(\(---\|+++\) [a-zA-Z0-9_/.-]*\).*/\1/" to strip
   dates
 
-- set -x and pipelines don't generate stable output
-
-  turn off set -x or break pipelines into pieces
-
--- a/tests/fish-merge
+++ b/tests/fish-merge
@@ -1,16 +1,16 @@
 #!/bin/sh
 
 set -e
 set -x
 
 # skip commit logs
-export HGMERGE=tkmerge
-export EDITOR=true
+HGMERGE=tkmerge; export HGMERGE
+EDITOR=true; export EDITOR
 
 rm -rf m m1 m2
 mkdir m
 cd m
 
 echo "m     this  that"
 echo "this" > a
 echo "that" > b
--- a/tests/run-tests
+++ b/tests/run-tests
@@ -1,102 +1,137 @@
 #!/bin/sh -e
 
-export LANG=C
-export LC_CTYPE="C"
-export LC_NUMERIC="C"
-export LC_TIME="C"
-export LC_COLLATE="C"
-export LC_MONETARY="C"
-export LC_MESSAGES="C"
-export LC_PAPER="C"
-export LC_NAME="C"
-export LC_ADDRESS="C"
-export LC_TELEPHONE="C"
-export LC_MEASUREMENT="C"
-export LC_IDENTIFICATION="C"
-export LC_ALL=""
-export HGEDITOR=true
-export HGMERGE=true
-export HGUSER=test
+LANG="C"; export LANG
+LC_CTYPE="C"; export LC_CTYPE
+LC_NUMERIC="C"; export LC_NUMERIC
+LC_TIME="C"; export LC_TIME
+LC_COLLATE="C"; export LC_COLLATE
+LC_MONETARY="C"; export LC_MONETARY
+LC_MESSAGES="C"; export LC_MESSAGES
+LC_PAPER="C"; export LC_PAPER
+LC_NAME="C"; export LC_NAME
+LC_ADDRESS="C"; export LC_ADDRESS
+LC_TELEPHONE="C"; export LC_TELEPHONE
+LC_MEASUREMENT="C"; export LC_MEASUREMENT
+LC_IDENTIFICATION="C"; export LC_IDENTIFICATION
+LC_ALL=""; export LC_ALL
+TZ=GMT; export TZ
+HGEDITOR=true; export HGEDITOR
+HGMERGE=true; export HGMERGE
+HGUSER="test"; export HGUSER
 
 umask 022
 
 tests=0
 failed=0
-H=$PWD
+
+HGTMP=""
+cleanup_exit() {
+    rm -rf "$HGTMP"
+    exit $1
+}
+
+# Remove temporary files even if we get interrupted
+trap "cleanup_exit 255" TERM KILL INT QUIT ABRT
+
+HGTMP="${TMPDIR-/tmp}/hgtests.$RANDOM.$RANDOM.$RANDOM.$$"
+(umask 077 && mkdir "$HGTMP") || {
+    echo "Could not create temporary directory! Exiting." 1>&2
+    exit 1
+}
+
+TESTDIR="$PWD"
 
 if [ -d /usr/lib64 ]; then
     lib=lib64
 else
     lib=lib
 fi
 
-TESTPATH=$PWD/install/bin
-export PATH=$TESTPATH:$PATH
-export PYTHONPATH=$PWD/install/$lib/python
-
-rm -rf install
+INST="$HGTMP/install"
 cd ..
-${PYTHON:-python} setup.py install --home=tests/install > tests/install.err
-if [ $? != 0 ] ; then
+if ${PYTHON-python} setup.py install --home="$INST" > tests/install.err 2>&1
+then
+    rm tests/install.err
+    mv "$INST/bin/hg" "$INST/bin/hg.real"
+    (
+	echo '#!/bin/sh'
+	echo 'echo "+ hg $@"'
+	echo 'exec hg.real "$@"'
+    ) > "$INST/bin/hg"
+    chmod 755 "$INST/bin/hg"
+else
     cat tests/install.err
+    cleanup_exit 1
 fi
-cd $H
-rm install.err
+cd "$TESTDIR"
 
-function run_one
-{
-    rm -f $1.err
-    export TZ=GMT
-    D=`mktemp -d ${TMP-/tmp}/tmp.XXXXXX`
-    if [ "$D" = "" ] ; then
-	echo mktemp failed!
-    fi
+PATH="$INST/bin:$PATH"; export PATH
+PYTHONPATH="$INST/$lib/python"; export PYTHONPATH
+
+
+run_one() {
+    rm -f "$1.err"
 
-    cd $D
+    mkdir "$HGTMP/$1"
+    cd "$HGTMP/$1"
     fail=0
-    export HOME=$D
+    HOME="$HGTMP/$1"; export HOME
+    OUT="$HGTMP/$1.out"
+    OUTOK="$TESTDIR/$1.out"
+    ERR="$TESTDIR/$1.err"
 
-    if ! $H/$1 > .out 2>&1 ; then
-	echo $1 failed with error code $?
+    if "$TESTDIR/$1" > "$OUT" 2>&1; then
+	: no error
+    else
+	echo "$1 failed with error code $?"
 	fail=1
     fi
 
-    if [ -s .out -a ! -r $H/$1.out ] ; then
-	echo $1 generated unexpected output:
-	cat .out
-	cp .out $H/$1.err
+    if [ -s "$OUT" -a ! -s "$OUTOK" ] ; then
+	cp "$OUT" "$ERR"
+	echo
+	echo "$1 generated unexpected output:"
+	cat "$ERR"
 	fail=1
-    elif [ -r $H/$1.out ] && ! diff -u $H/$1.out .out > /dev/null ; then
-	echo $1 output changed:
-	diff -u $H/$1.out .out && true
-	cp .out $H/$1.err
-	fail=1
+    elif [ -r "$OUTOK" ]; then
+	if diff -u "$OUTOK" "$OUT" > /dev/null; then
+	    : no differences
+	else
+	    if FIXME="`grep 'FIXME' \"$TESTDIR/$1\"`"; then
+		echo
+		echo "$1 failed, but this is ignored because of:"
+		echo "$FIXME"
+	    else
+		cp "$OUT" "$ERR"
+		echo
+		echo "$1 output changed:"
+		diff -u "$OUTOK" "$ERR" || true
+		fail=1
+	    fi
+	fi
     fi
 
-    cd $H
-    rm -r $D
+    cd "$TESTDIR"
+    rm -f "$HGTMP/$1.out"
+    rm -rf "$HGTMP/$1"
     return $fail
 }
 
-TESTS=$@
-if [ "$TESTS" = "" ] ; then
-    TESTS=`ls test-* | grep -Ev "\.|~"`
+TESTS="$*"
+if [ -z "$TESTS" ] ; then
+    TESTS=`ls test-* | grep -v "[.~]"`
 fi
 
 for f in $TESTS ; do
     echo -n "."
-    if ! run_one $f ; then
-	failed=$[$failed + 1]
-    fi
-    tests=$[$tests + 1]
+    run_one $f || failed=`expr $failed + 1`
+    tests=`expr $tests + 1`
 done
 
-rm -rf install
-
 echo
-echo Ran $tests tests, $failed failed
+echo "Ran $tests tests, $failed failed."
 
 if [ $failed -gt 0 ] ; then
-    exit 1
+    cleanup_exit 1
 fi
-
+cleanup_exit 0
--- a/tests/test-backwards-remove
+++ b/tests/test-backwards-remove
@@ -1,9 +1,9 @@
-#!/bin/sh -x
+#!/bin/sh
 hg init
 echo This is file a1 > a
 hg add a
 hg commit -m "commit #0" -d "0 0"
 ls
 echo This is file b1 > b
 hg add b
 hg commit -m "commit #1" -d "0 0"
--- a/tests/test-backwards-remove.out
+++ b/tests/test-backwards-remove.out
@@ -1,12 +1,8 @@
 + hg init
-+ echo This is file a1
 + hg add a
-+ hg commit -m 'commit #0' -d '0 0'
-+ ls
++ hg commit -m commit #0 -d 0 0
 a
-+ echo This is file b1
 + hg add b
-+ hg commit -m 'commit #1' -d '0 0'
++ hg commit -m commit #1 -d 0 0
 + hg co 0
-+ ls
 a
--- a/tests/test-bad-pull
+++ b/tests/test-bad-pull
@@ -1,9 +1,9 @@
-#!/bin/sh -x
+#!/bin/sh
 
 hg clone http://localhost:20059/ copy
 echo $?
 ls copy
 
 cat > dumb.py <<EOF
 import BaseHTTPServer, SimpleHTTPServer, signal
 
@@ -12,17 +12,14 @@ def run(server_class=BaseHTTPServer.HTTP
     server_address = ('localhost', 20059)
     httpd = server_class(server_address, handler_class)
     httpd.serve_forever()
 
 signal.signal(signal.SIGTERM, lambda x: sys.exit(0))
 run()
 EOF
 
-set +x # backgrounding sometimes disturbs the order of command tracing
 python dumb.py 2>/dev/null &
-set -x
 
 hg clone http://localhost:20059/foo copy2
 echo $?
 
-set +x
 kill $!
--- a/tests/test-bad-pull.out
+++ b/tests/test-bad-pull.out
@@ -1,15 +1,9 @@
 + hg clone http://localhost:20059/ copy
 requesting all changes
 abort: error: Connection refused
-+ echo 255
 255
-+ ls copy
 ls: copy: No such file or directory
-+ cat
-+ set +x
 + hg clone http://localhost:20059/foo copy2
 requesting all changes
 abort: HTTP Error 404: File not found
-+ echo 255
 255
-+ set +x
--- a/tests/test-basic
+++ b/tests/test-basic
@@ -1,11 +1,10 @@
 #!/bin/sh
 
-set -x
 mkdir t
 cd t
 hg init
 echo a > a
 hg add a
 hg commit -m test -d "0 0"
 hg history
 hg manifest
--- a/tests/test-basic.out
+++ b/tests/test-basic.out
@@ -1,14 +1,11 @@
-+ mkdir t
-+ cd t
 + hg init
-+ echo a
 + hg add a
-+ hg commit -m test -d '0 0'
++ hg commit -m test -d 0 0
 + hg history
 changeset:   0:acb14030fe0a
 tag:         tip
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 summary:     test
 
 + hg manifest
--- a/tests/test-clone
+++ b/tests/test-clone
@@ -1,11 +1,10 @@
 #!/bin/bash
 
-set -x
 mkdir a
 cd a
 hg init
 echo a > a
 hg add a
 hg commit -m test -d '0 0'
 
 # Default operation
--- a/tests/test-clone-failure
+++ b/tests/test-clone-failure
@@ -1,12 +1,10 @@
 #!/bin/bash
 
-set -x
-
 # No local source
 hg clone a b
 echo $?
 
 # No remote source
 hg clone http://127.0.0.1:3121/a b
 echo $?
 rm -rf b # work around bug with http clone
--- a/tests/test-clone-failure.out
+++ b/tests/test-clone-failure.out
@@ -1,39 +1,20 @@
 + hg clone a b
 abort: repository a/.hg not found!
-+ echo 255
 255
 + hg clone http://127.0.0.1:3121/a b
 requesting all changes
 abort: error: Connection refused
-+ echo 255
 255
-+ rm -rf b
-+ mkdir a
-+ chmod 000 a
 + hg clone a b
 abort: repository a/.hg not found!
-+ echo 255
 255
-+ mkdir b
-+ cd b
 + hg init
 + hg clone . ../a
 abort: destination '../a' already exists
-+ echo 1
 1
-+ cd ..
-+ chmod 700 a
-+ rm -rf a b
-+ mkfifo a
 + hg clone a b
 abort: repository a/.hg not found!
-+ echo 255
 255
-+ rm a
-+ mkdir q
-+ cd q
 + hg init
-+ cd ..
 + hg clone q
 abort: destination 'q' already exists
-+ true
--- a/tests/test-clone.out
+++ b/tests/test-clone.out
@@ -1,32 +1,22 @@
-+ mkdir a
-+ cd a
 + hg init
-+ echo a
 + hg add a
-+ hg commit -m test -d '0 0'
++ hg commit -m test -d 0 0
 + hg clone . ../b
-+ cd ../b
-+ cat a
 a
 + hg verify
 checking changesets
 checking manifests
 crosschecking files in changesets and manifests
 checking files
 1 files, 1 changesets, 1 total revisions
 + hg clone -U . ../c
-+ cd ../c
-+ cat a
 cat: a: No such file or directory
 + hg verify
 checking changesets
 checking manifests
 crosschecking files in changesets and manifests
 checking files
 1 files, 1 changesets, 1 total revisions
-+ mkdir ../d
-+ cd ../d
 + hg clone ../a
-+ cd a
 + hg cat a
 a
--- a/tests/test-conflict
+++ b/tests/test-conflict
@@ -1,17 +1,16 @@
 #!/bin/sh
 
-set -x
 hg init
 echo "nothing" > a
 hg add a
 hg commit -m ancestor -d "0 0"
 echo "something" > a
 hg commit -m branch1 -d "0 0"
 hg co 0
 echo "something else" > a
 hg commit -m branch2 -d "0 0"
-export HGMERGE=merge
+HGMERGE=merge; export HGMERGE
 hg up -m 1
 hg id
 grep -Ev ">>>|<<<" a
 hg status
--- a/tests/test-conflict.out
+++ b/tests/test-conflict.out
@@ -1,24 +1,17 @@
 + hg init
-+ echo nothing
 + hg add a
-+ hg commit -m ancestor -d '0 0'
-+ echo something
-+ hg commit -m branch1 -d '0 0'
++ hg commit -m ancestor -d 0 0
++ hg commit -m branch1 -d 0 0
 + hg co 0
-+ echo 'something else'
-+ hg commit -m branch2 -d '0 0'
-+ export HGMERGE=merge
-+ HGMERGE=merge
++ hg commit -m branch2 -d 0 0
 + hg up -m 1
 merge: warning: conflicts during merge
 merging a
 merging a failed!
 + hg id
 32e80765d7fe+75234512624c+ tip
-+ grep -Ev '>>>|<<<' a
 something else
 =======
 something
 + hg status
 M a
-? .out
--- a/tests/test-copy
+++ b/tests/test-copy
@@ -1,20 +1,19 @@
 #!/bin/sh
 
-set -x
 hg init
 echo a > a
 hg add a
 hg commit -m "1" -d "0 0"
 hg status
 cp a b
 hg copy a b
 hg status
 hg --debug commit -m "2" -d "0 0"
 hg history
 hg log a
-hexdump -C .hg/data/b.d
+md5sum .hg/data/b.d
 hg cat b > bsum
 md5sum bsum
 hg cat a > asum
 md5sum asum
 hg verify
--- a/tests/test-copy.out
+++ b/tests/test-copy.out
@@ -1,20 +1,16 @@
 + hg init
-+ echo a
 + hg add a
-+ hg commit -m 1 -d '0 0'
++ hg commit -m 1 -d 0 0
 + hg status
-? .out
-+ cp a b
 + hg copy a b
 + hg status
 A b
-? .out
-+ hg --debug commit -m 2 -d '0 0'
++ hg --debug commit -m 2 -d 0 0
 b
  b: copy a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
 + hg history
 changeset:   1:3b5b84850bbe
 tag:         tip
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 summary:     2
@@ -25,27 +21,17 @@ date:        Thu Jan  1 00:00:00 1970
 summary:     1
 
 + hg log a
 changeset:   0:c19d34741b0a
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 summary:     1
 
-+ hexdump -C .hg/data/b.d
-00000000  75 01 0a 63 6f 70 79 72  65 76 3a 20 62 37 38 39  |u..copyrev: b789|
-00000010  66 64 64 39 36 64 63 32  66 33 62 64 32 32 39 63  |fdd96dc2f3bd229c|
-00000020  31 64 64 38 65 65 64 66  30 66 63 36 30 65 32 62  |1dd8eedf0fc60e2b|
-00000030  36 38 65 33 0a 63 6f 70  79 3a 20 61 0a 01 0a 61  |68e3.copy: a...a|
-00000040  0a                                                |.|
-00000041
-+ hg cat b
-+ md5sum bsum
-60b725f10c9c85c70d97880dfe8191b3  bsum
-+ hg cat a
-+ md5sum asum
-60b725f10c9c85c70d97880dfe8191b3  asum
+566e338d09a089ba737c21e0d3759980  .hg/data/b.d
+3268d2f51b2d2d423ff01b59eb6fbb14  bsum
+70909ca2ecf494c71e9184b445e040ee  asum
 + hg verify
 checking changesets
 checking manifests
 crosschecking files in changesets and manifests
 checking files
 2 files, 2 changesets, 2 total revisions
--- a/tests/test-diffdir
+++ b/tests/test-diffdir
@@ -2,11 +2,11 @@
 
 hg init
 touch a
 hg add a
 hg ci -m "a" -d "0 0"
 
 echo 123 > b
 hg add b
-hg diff | sed "s/\(\(---\|+++\) [^ \t]*\)[ \t].*/\1/"
+hg diff | sed "s/\(\(---\|+++\) [a-zA-Z0-9_/.-]*\).*/\1/"
 
-hg diff -r tip | sed "s/\(\(---\|+++\) [^ \t]*\)[ \t].*/\1/"
+hg diff -r tip | sed "s/\(\(---\|+++\) [a-zA-Z0-9_/.-]*\).*/\1/"
--- a/tests/test-diffdir.out
+++ b/tests/test-diffdir.out
@@ -1,10 +1,16 @@
++ hg init
++ hg add a
++ hg ci -m a -d 0 0
++ hg add b
++ hg diff
 diff -r 3903775176ed b
 --- /dev/null
 +++ b/b
 @@ -0,0 +1,1 @@
 +123
++ hg diff -r tip
 diff -r 3903775176ed b
 --- /dev/null
 +++ b/b
 @@ -0,0 +1,1 @@
 +123
--- a/tests/test-empty-dir.out
+++ b/tests/test-empty-dir.out
@@ -1,3 +1,9 @@
++ hg init
++ hg add a
++ hg commit -m first -d 0 0 a
++ hg add sub/b
++ hg commit -m second -d 0 0 sub/b
 321
++ hg co 0
 cat: sub/b: No such file or directory
 ls: sub: No such file or directory
--- a/tests/test-flags
+++ b/tests/test-flags
@@ -1,9 +1,9 @@
-#!/bin/sh -ex
+#!/bin/sh -e
 
 umask 027
 mkdir test1
 cd test1
 
 hg init
 touch a b
 hg add a b
--- a/tests/test-flags.out
+++ b/tests/test-flags.out
@@ -1,33 +1,23 @@
-+ umask 027
-+ mkdir test1
-+ cd test1
 + hg init
-+ touch a b
 + hg add a b
-+ hg ci -m 'added a b' -d '0 0'
-+ cd ..
-+ mkdir test2
-+ cd test2
++ hg ci -m added a b -d 0 0
 + hg init
 + hg pull ../test1
 pulling from ../test1
 requesting all changes
 adding changesets
 adding manifests
 adding file changes
 added 1 changesets with 2 changes to 2 files
 (run 'hg update' to get a working copy)
 + hg co
-+ chmod +x a
-+ hg ci -m 'chmod +x a' -d '0 0'
-+ cd ../test1
-+ echo 123
-+ hg ci -m 'a updated' -d '0 0'
++ hg ci -m chmod +x a -d 0 0
++ hg ci -m a updated -d 0 0
 + hg pull ../test2
 pulling from ../test2
 searching for changes
 adding changesets
 adding manifests
 adding file changes
 added 1 changesets with 1 changes to 1 files
 (run 'hg update' to get a working copy)
@@ -61,12 +51,10 @@ changeset:   0:22a449e20da5
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 summary:     added a b
 
 + hg -v co -m
 resolving manifests
 merging a
 resolving a
-+ ls -l ../test1/a ../test2/a
-+ cut -b 0-10
 -rwxr-x---
 -rwxr-x---
--- a/tests/test-help.out
+++ b/tests/test-help.out
@@ -1,8 +1,9 @@
++ hg help
 basic hg commands (use "hg help -v" for more):
 
  add        add the specified files on the next commit
  annotate   show changeset information per file line
  clone      make a copy of an existing repository
  commit     commit the specified files or all outstanding changes
  diff       diff working directory (or selected files)
  export     dump the header and diffs for one or more changesets
@@ -10,16 +11,17 @@ basic hg commands (use "hg help -v" for 
  log        show the revision history of the repository or a single file
  pull       pull changes from the specified source
  push       push changes to the specified destination
  remove     remove the specified files on the next commit
  revert     revert modified files or dirs back to their unmodified states
  serve      export the repository via HTTP
  status     show changed files in the working directory
  update     update or merge working directory
++ hg -q help
 basic hg commands (use "hg help -v" for more):
 
  add        add the specified files on the next commit
  annotate   show changeset information per file line
  clone      make a copy of an existing repository
  commit     commit the specified files or all outstanding changes
  diff       diff working directory (or selected files)
  export     dump the header and diffs for one or more changesets
@@ -27,45 +29,50 @@ basic hg commands (use "hg help -v" for 
  log        show the revision history of the repository or a single file
  pull       pull changes from the specified source
  push       push changes to the specified destination
  remove     remove the specified files on the next commit
  revert     revert modified files or dirs back to their unmodified states
  serve      export the repository via HTTP
  status     show changed files in the working directory
  update     update or merge working directory
++ hg add -h
 hg add: option -h not recognized
 hg add [FILE]...
 
  -I --include 
    include path in search
  -X --exclude 
    exclude path from search
 
 add the specified files on the next commit
++ hg add --skjdfks
 hg add: option --skjdfks not recognized
 hg add [FILE]...
 
  -I --include 
    include path in search
  -X --exclude 
    exclude path from search
 
 add the specified files on the next commit
++ hg help diff
 hg diff [-r REV1 [-r REV2]] [FILE]...
 
  -r --rev 
    revision
  -I --include 
    include path in search
  -X --exclude 
    exclude path from search
 
 diff working directory (or selected files)
++ hg help foo
 hg: unknown command foo
++ hg -q commands
 hg: unknown command 'commands'
 basic hg commands (use "hg help -v" for more):
 
  add        add the specified files on the next commit
  annotate   show changeset information per file line
  clone      make a copy of an existing repository
  commit     commit the specified files or all outstanding changes
  diff       diff working directory (or selected files)
--- a/tests/test-hook
+++ b/tests/test-hook
@@ -1,9 +1,9 @@
-#!/bin/sh -x
+#!/bin/sh
 
 hg init
 echo "[hooks]" > .hg/hgrc
 echo 'precommit = echo precommit hook' >> .hg/hgrc
 echo 'commit = echo commit hook: $NODE' >> .hg/hgrc
 echo a > a
 hg add a
 hg commit -m "test" -d "0 0"
--- a/tests/test-hook.out
+++ b/tests/test-hook.out
@@ -1,9 +1,5 @@
 + hg init
-+ echo '[hooks]'
-+ echo 'precommit = echo precommit hook'
-+ echo 'commit = echo commit hook: $NODE'
-+ echo a
 + hg add a
-+ hg commit -m test -d '0 0'
++ hg commit -m test -d 0 0
 precommit hook
 commit hook: acb14030fe0a21b60322c440ad2d20cf7685a376
--- a/tests/test-hup.out
+++ b/tests/test-hup.out
@@ -1,8 +1,10 @@
++ hg init
++ hg serve --stdio
 0
 0
 adding changesets
 killed!
 transaction abort!
 rollback completed
 00changelog.d
 00changelog.i
new file mode 100755
--- /dev/null
+++ b/tests/test-merge-revert
@@ -0,0 +1,46 @@
+#!/bin/sh
+# FIXME: This test may fail due to an uncritical bug in Mercurial.
+
+mkdir t
+cd t
+hg init
+echo "added file1" > file1
+echo "added file2" > file2
+hg add file1 file2
+hg commit -m "added file1 and file2" -d "0 0" -u user
+echo "changed file1" >> file1
+hg commit -m "changed file1" -d "0 0" -u user
+hg -q log
+hg id
+hg update -C 0
+hg id
+echo "changed file1" >> file1
+hg id
+hg revert
+hg diff
+hg status
+hg id
+hg update
+hg diff
+hg status
+hg id
+hg update -C 0
+echo "changed file1" >> file1
+HGMERGE=merge hg update
+hg diff
+hg status
+hg id
+hg revert
+hg diff
+hg status
+hg id
+hg revert -r tip
+hg diff
+hg status
+hg id
+hg update -C
+hg diff
+hg status
+hg id
+cd ..; /bin/rm -rf t
+
new file mode 100644
--- /dev/null
+++ b/tests/test-merge-revert.out
@@ -0,0 +1,46 @@
++ hg init
++ hg add file1 file2
++ hg commit -m added file1 and file2 -d 0 0 -u user
++ hg commit -m changed file1 -d 0 0 -u user
++ hg -q log
+1:3aa14bbc23d90e3f8b5b639b4a43d76509bae76c
+0:8633637036c18f021d771208e16ae3508ab81d28
++ hg id
+3aa14bbc23d9 tip
++ hg update -C 0
++ hg id
+8633637036c1
++ hg id
+8633637036c1+
++ hg revert
++ hg diff
++ hg status
++ hg id
+8633637036c1
++ hg update
++ hg diff
++ hg status
++ hg id
+3aa14bbc23d9 tip
++ hg update -C 0
++ hg update
+merging file1
++ hg diff
++ hg status
++ hg id
+3aa14bbc23d9 tip
++ hg revert
++ hg diff
++ hg status
++ hg id
+3aa14bbc23d9 tip
++ hg revert -r tip
++ hg diff
++ hg status
++ hg id
+3aa14bbc23d9 tip
++ hg update -C
++ hg diff
++ hg status
++ hg id
+3aa14bbc23d9 tip
new file mode 100755
--- /dev/null
+++ b/tests/test-merge-revert2
@@ -0,0 +1,46 @@
+#!/bin/sh
+# FIXME: This test may fail due to an uncritical bug in Mercurial.
+
+mkdir t
+cd t
+hg init
+echo "added file1" > file1
+echo "added file2" > file2
+hg add file1 file2
+hg commit -m "added file1 and file2" -d "0 0" -u user
+echo "changed file1" >> file1
+hg commit -m "changed file1" -d "0 0" -u user
+hg -q log
+hg id
+hg update -C 0
+hg id
+echo "changed file1" >> file1
+hg id
+hg revert
+hg diff
+hg status
+hg id
+hg update
+hg diff
+hg status
+hg id
+hg update -C 0
+echo "changed file1 different" >> file1
+HGMERGE=merge hg update
+hg diff | sed -e "s/\(\(---\|+++\) [a-zA-Z0-9_/.-]*\).*/\1/" -e "s/\(<<<<<<<\|>>>>>>>\) .*/\1/"
+hg status
+hg id
+hg revert
+hg diff
+hg status
+hg id
+hg revert -r tip
+hg diff
+hg status
+hg id
+hg update -C
+hg diff
+hg status
+hg id
+cd ..; /bin/rm -rf t
+
new file mode 100644
--- /dev/null
+++ b/tests/test-merge-revert2.out
@@ -0,0 +1,59 @@
++ hg init
++ hg add file1 file2
++ hg commit -m added file1 and file2 -d 0 0 -u user
++ hg commit -m changed file1 -d 0 0 -u user
++ hg -q log
+1:3aa14bbc23d90e3f8b5b639b4a43d76509bae76c
+0:8633637036c18f021d771208e16ae3508ab81d28
++ hg id
+3aa14bbc23d9 tip
++ hg update -C 0
++ hg id
+8633637036c1
++ hg id
+8633637036c1+
++ hg revert
++ hg diff
++ hg status
++ hg id
+8633637036c1
++ hg update
++ hg diff
++ hg status
++ hg id
+3aa14bbc23d9 tip
++ hg update -C 0
++ hg update
+merge: warning: conflicts during merge
+merging file1
+merging file1 failed!
++ hg diff
+diff -r 3aa14bbc23d9 file1
+--- a/file1
++++ b/file1
+@@ -1,2 +1,6 @@
+ added file1
++<<<<<<<
++changed file1 different
++=======
+ changed file1
++>>>>>>>
++ hg status
+M file1
++ hg id
+3aa14bbc23d9+ tip
++ hg revert
++ hg diff
++ hg status
++ hg id
+3aa14bbc23d9 tip
++ hg revert -r tip
++ hg diff
++ hg status
++ hg id
+3aa14bbc23d9 tip
++ hg update -C
++ hg diff
++ hg status
++ hg id
+3aa14bbc23d9 tip
--- a/tests/test-merge1
+++ b/tests/test-merge1
@@ -1,9 +1,9 @@
-#!/bin/sh -x
+#!/bin/sh
 
 cat <<'EOF' > merge
 #!/bin/sh
 echo merging for `basename $1`
 EOF
 chmod +x merge
 
 mkdir t
--- a/tests/test-merge1.out
+++ b/tests/test-merge1.out
@@ -1,82 +1,45 @@
-+ cat
-+ chmod +x merge
-+ mkdir t
-+ cd t
 + hg init
-+ echo This is file a1
 + hg add a
-+ hg commit -m 'commit #0' -d '0 0'
-+ echo This is file b1
++ hg commit -m commit #0 -d 0 0
 + hg add b
-+ hg commit -m 'commit #1' -d '0 0'
++ hg commit -m commit #1 -d 0 0
 + hg update 0
-+ echo This is file c1
 + hg add c
-+ hg commit -m 'commit #2' -d '0 0'
-+ echo This is file b1
-+ env HGMERGE=../merge hg update -m 1
-+ cd ..
-+ /bin/rm -rf t
-+ mkdir t
-+ cd t
++ hg commit -m commit #2 -d 0 0
++ hg update -m 1
 + hg init
-+ echo This is file a1
 + hg add a
-+ hg commit -m 'commit #0' -d '0 0'
-+ echo This is file b1
++ hg commit -m commit #0 -d 0 0
 + hg add b
-+ hg commit -m 'commit #1' -d '0 0'
++ hg commit -m commit #1 -d 0 0
 + hg update 0
-+ echo This is file c1
 + hg add c
-+ hg commit -m 'commit #2' -d '0 0'
-+ echo This is file b2
-+ env HGMERGE=../merge hg update -m 1
++ hg commit -m commit #2 -d 0 0
++ hg update -m 1
 merging for b
 merging b
-+ cd ..
-+ /bin/rm -rf t
-+ mkdir t
-+ cd t
 + hg init
-+ echo This is file a1
 + hg add a
-+ hg commit -m 'commit #0' -d '0 0'
-+ echo This is file b1
++ hg commit -m commit #0 -d 0 0
 + hg add b
-+ hg commit -m 'commit #1' -d '0 0'
-+ echo This is file b22
-+ hg commit -m 'commit #2' -d '0 0'
++ hg commit -m commit #1 -d 0 0
++ hg commit -m commit #2 -d 0 0
 + hg update 1
-+ echo This is file c1
 + hg add c
-+ hg commit -m 'commit #3' -d '0 0'
-+ cat b
++ hg commit -m commit #3 -d 0 0
 This is file b1
-+ echo This is file b22
-+ env HGMERGE=../merge hg update -m 2
++ hg update -m 2
 merging for b
 merging b
-+ cd ..
-+ /bin/rm -rf t
-+ mkdir t
-+ cd t
 + hg init
-+ echo This is file a1
 + hg add a
-+ hg commit -m 'commit #0' -d '0 0'
-+ echo This is file b1
++ hg commit -m commit #0 -d 0 0
 + hg add b
-+ hg commit -m 'commit #1' -d '0 0'
-+ echo This is file b22
-+ hg commit -m 'commit #2' -d '0 0'
++ hg commit -m commit #1 -d 0 0
++ hg commit -m commit #2 -d 0 0
 + hg update 1
-+ echo This is file c1
 + hg add c
-+ hg commit -m 'commit #3' -d '0 0'
-+ echo This is file b33
-+ env HGMERGE=../merge hg update -m 2
++ hg commit -m commit #3 -d 0 0
++ hg update -m 2
 merging for b
 merging b
-+ cd ..
-+ /bin/rm -rf t
--- a/tests/test-merge2
+++ b/tests/test-merge2
@@ -1,9 +1,9 @@
-#!/bin/sh -x
+#!/bin/sh
 
 mkdir t
 cd t
 hg init
 echo This is file a1 > a
 hg add a
 hg commit -m "commit #0" -d "0 0"
 echo This is file b1 > b
--- a/tests/test-merge2.out
+++ b/tests/test-merge2.out
@@ -1,49 +1,25 @@
-+ mkdir t
-+ cd t
 + hg init
-+ echo This is file a1
 + hg add a
-+ hg commit -m 'commit #0' -d '0 0'
-+ echo This is file b1
++ hg commit -m commit #0 -d 0 0
 + hg add b
-+ hg commit -m 'commit #1' -d '0 0'
-+ rm b
++ hg commit -m commit #1 -d 0 0
 + hg update 0
-+ echo This is file b2
 + hg add b
-+ hg commit -m 'commit #2' -d '0 0'
-+ cd ..
-+ /bin/rm -rf t
-+ mkdir t
-+ cd t
++ hg commit -m commit #2 -d 0 0
 + hg init
-+ echo This is file a1
 + hg add a
-+ hg commit -m 'commit #0' -d '0 0'
-+ echo This is file b1
++ hg commit -m commit #0 -d 0 0
 + hg add b
-+ hg commit -m 'commit #1' -d '0 0'
-+ rm b
++ hg commit -m commit #1 -d 0 0
 + hg update 0
-+ echo This is file b2
-+ hg commit -A -m 'commit #2' -d '0 0'
++ hg commit -A -m commit #2 -d 0 0
 adding b
-+ cd ..
-+ /bin/rm -rf t
-+ mkdir t
-+ cd t
 + hg init
-+ echo This is file a1
 + hg add a
-+ hg commit -m 'commit #0' -d '0 0'
-+ echo This is file b1
++ hg commit -m commit #0 -d 0 0
 + hg add b
-+ hg commit -m 'commit #1' -d '0 0'
-+ rm b
++ hg commit -m commit #1 -d 0 0
 + hg remove b
 + hg update 0
-+ echo This is file b2
-+ hg commit -A -m 'commit #2' -d '0 0'
++ hg commit -A -m commit #2 -d 0 0
 adding b
-+ cd ..
-+ /bin/rm -rf t
--- a/tests/test-merge3
+++ b/tests/test-merge3
@@ -1,9 +1,9 @@
-#!/bin/sh -x
+#!/bin/sh
 
 hg init
 echo This is file a1 > a
 hg add a
 hg commit -m "commit #0" -d "0 0"
 touch b
 hg add b
 rm b
--- a/tests/test-merge3.out
+++ b/tests/test-merge3.out
@@ -1,11 +1,8 @@
 + hg init
-+ echo This is file a1
 + hg add a
-+ hg commit -m 'commit #0' -d '0 0'
-+ touch b
++ hg commit -m commit #0 -d 0 0
 + hg add b
-+ rm b
-+ hg commit -A '-mcomment #1' -d '0 0'
-adding .out
++ hg commit -A -mcomment #1 -d 0 0
 removing b
 b never committed!
+nothing changed
--- a/tests/test-merge4
+++ b/tests/test-merge4
@@ -1,9 +1,9 @@
-#!/bin/sh -x
+#!/bin/sh
 
 hg init
 echo This is file a1 > a
 hg add a
 hg commit -m "commit #0" -d "0 0"
 echo This is file b1 > b
 hg add b
 hg commit -m "commit #1" -d "0 0"
--- a/tests/test-merge4.out
+++ b/tests/test-merge4.out
@@ -1,15 +1,10 @@
 + hg init
-+ echo This is file a1
 + hg add a
-+ hg commit -m 'commit #0' -d '0 0'
-+ echo This is file b1
++ hg commit -m commit #0 -d 0 0
 + hg add b
-+ hg commit -m 'commit #1' -d '0 0'
++ hg commit -m commit #1 -d 0 0
 + hg update 0
-+ echo This is file c1
 + hg add c
-+ hg commit -m 'commit #2' -d '0 0'
++ hg commit -m commit #2 -d 0 0
 + hg update -m 1
-+ rm b
-+ echo This is file c22
-+ hg commit -m 'commit #3' -d '0 0'
++ hg commit -m commit #3 -d 0 0
--- a/tests/test-merge5
+++ b/tests/test-merge5
@@ -1,9 +1,9 @@
-#!/bin/sh -x
+#!/bin/sh
 
 mkdir t
 cd t
 hg init
 echo This is file a1 > a
 echo This is file b1 > b
 hg add a b
 hg commit -m "commit #0" -d "0 0"
--- a/tests/test-merge5.out
+++ b/tests/test-merge5.out
@@ -1,20 +1,12 @@
-+ mkdir t
-+ cd t
 + hg init
-+ echo This is file a1
-+ echo This is file b1
 + hg add a b
-+ hg commit -m 'commit #0' -d '0 0'
-+ echo This is file b22
-+ hg commit '-mcomment #1' -d '0 0'
++ hg commit -m commit #0 -d 0 0
++ hg commit -mcomment #1 -d 0 0
 + hg update 0
-+ rm b
-+ hg commit -A '-mcomment #2' -d '0 0'
++ hg commit -A -mcomment #2 -d 0 0
 removing b
-+ yes k
 + hg update 1
 this update spans a branch affecting the following files:
  b
 aborting update spanning branches!
 (use update -m to perform a branch merge)
-+ exit 0
--- a/tests/test-merge6
+++ b/tests/test-merge6
@@ -1,16 +1,16 @@
-#!/bin/sh -x
+#!/bin/sh
 
 cat <<'EOF' > merge
 #!/bin/sh
 echo merging for `basename $1`
 EOF
 chmod +x merge
-export HGMERGE=./merge
+HGMERGE=./merge; export HGMERGE
 
 mkdir A1
 cd A1
 hg init
 echo This is file foo1 > foo
 echo This is file bar1 > bar
 hg add foo bar
 hg commit -m "commit text" -d "0 0"
--- a/tests/test-merge6.out
+++ b/tests/test-merge6.out
@@ -1,53 +1,35 @@
-+ cat
-+ chmod +x merge
-+ export HGMERGE=./merge
-+ HGMERGE=./merge
-+ mkdir A1
-+ cd A1
 + hg init
-+ echo This is file foo1
-+ echo This is file bar1
 + hg add foo bar
-+ hg commit -m 'commit text' -d '0 0'
-+ cd ..
++ hg commit -m commit text -d 0 0
 + hg clone A1 B1
-+ cd A1
-+ rm bar
 + hg remove bar
-+ hg commit -m 'commit test' -d '0 0'
-+ cd ../B1
-+ echo This is file foo22
-+ hg commit -m 'commit test' -d '0 0'
-+ cd ..
++ hg commit -m commit test -d 0 0
++ hg commit -m commit test -d 0 0
 + hg clone A1 A2
 + hg clone B1 B2
-+ cd A1
 + hg pull ../B1
 pulling from ../B1
 searching for changes
 adding changesets
 adding manifests
 adding file changes
 added 1 changesets with 1 changes to 1 files
 (run 'hg update' to get a working copy)
 + hg update -m
-+ hg commit -m 'commit test' -d '0 0'
-+ echo bar should remain deleted.
++ hg commit -m commit test -d 0 0
 bar should remain deleted.
 + hg manifest
 6b70e9e451a5a33faad7bbebe627e46b937b7364 644 foo
-+ cd ../B2
 + hg pull ../A2
 pulling from ../A2
 searching for changes
 adding changesets
 adding manifests
 adding file changes
 added 1 changesets with 0 changes to 0 files
 (run 'hg update' to get a working copy)
 + hg update -m
-+ hg commit -m 'commit test' -d '0 0'
-+ echo bar should remain deleted.
++ hg commit -m commit test -d 0 0
 bar should remain deleted.
 + hg manifest
 6b70e9e451a5a33faad7bbebe627e46b937b7364 644 foo
--- a/tests/test-pull
+++ b/tests/test-pull
@@ -3,16 +3,17 @@
 mkdir test
 cd test
 echo foo>foo
 hg init
 hg addremove
 hg commit -m 1
 hg verify
 hg serve -p 20059 > /dev/null &
+sleep 1 # wait for server to be started
 cd ..
 
 hg clone http://localhost:20059/ copy
 cd copy
 hg verify
 hg co
 cat foo
 hg manifest
--- a/tests/test-pull.out
+++ b/tests/test-pull.out
@@ -1,22 +1,31 @@
++ hg init
++ hg addremove
 adding foo
++ hg commit -m 1
++ hg verify
 checking changesets
 checking manifests
 crosschecking files in changesets and manifests
 checking files
 1 files, 1 changesets, 1 total revisions
++ hg clone http://localhost:20059/ copy
 requesting all changes
 adding changesets
 adding manifests
 adding file changes
 added 1 changesets with 1 changes to 1 files
++ hg verify
 checking changesets
 checking manifests
 crosschecking files in changesets and manifests
 checking files
 1 files, 1 changesets, 1 total revisions
++ hg co
 foo
++ hg manifest
 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
++ hg pull
 pulling from http://localhost:20059/
 searching for changes
 no changes found
 killed!
--- a/tests/test-rawcommit1
+++ b/tests/test-rawcommit1
@@ -1,9 +1,9 @@
-#!/bin/sh -x
+#!/bin/sh
 hg --debug init
 echo this is a1 > a
 hg add a
 hg commit -m0 -d "0 0" 
 echo this is b1 > b
 hg add b
 hg commit -m1 -d "0 0" 
 hg manifest 1
--- a/tests/test-rawcommit1.out
+++ b/tests/test-rawcommit1.out
@@ -1,81 +1,75 @@
 + hg --debug init
-+ echo this is a1
 + hg add a
-+ hg commit -m0 -d '0 0'
-+ echo this is b1
++ hg commit -m0 -d 0 0
 + hg add b
-+ hg commit -m1 -d '0 0'
++ hg commit -m1 -d 0 0
 + hg manifest 1
 05f9e54f4c9b86b09099803d8b49a50edcb4eaab 644 a
 54837d97f2932a8194e69745a280a2c11e61ff9c 644 b
-+ echo this is c1
-+ hg rawcommit -p 1 -d '0 0' -m2 c
++ hg rawcommit -p 1 -d 0 0 -m2 c
 + hg manifest 2
 05f9e54f4c9b86b09099803d8b49a50edcb4eaab 644 a
 54837d97f2932a8194e69745a280a2c11e61ff9c 644 b
 76d5e637cbec1bcc04a5a3fa4bcc7d13f6847c00 644 c
 + hg parents
 changeset:   2:9f827976dae4
 tag:         tip
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 summary:     2
 
-+ rm b
-+ hg rawcommit -p 2 -d '0 0' -m3 b
++ hg rawcommit -p 2 -d 0 0 -m3 b
 + hg manifest 3
 05f9e54f4c9b86b09099803d8b49a50edcb4eaab 644 a
 76d5e637cbec1bcc04a5a3fa4bcc7d13f6847c00 644 c
 + hg parents
 changeset:   3:c8225a106186
 tag:         tip
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 summary:     3
 
-+ echo this is a22
-+ hg rawcommit -p 3 -d '0 0' -m4 a
++ hg rawcommit -p 3 -d 0 0 -m4 a
 + hg manifest 4
 d6e3c4976c13feb1728cd3ac851abaf7256a5c23 644 a
 76d5e637cbec1bcc04a5a3fa4bcc7d13f6847c00 644 c
 + hg parents
 changeset:   4:8dfeee82a94b
 tag:         tip
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 summary:     4
 
-+ echo this is c22
-+ hg rawcommit -p 1 -d '0 0' -m5 c
++ hg rawcommit -p 1 -d 0 0 -m5 c
 + hg manifest 5
 05f9e54f4c9b86b09099803d8b49a50edcb4eaab 644 a
 54837d97f2932a8194e69745a280a2c11e61ff9c 644 b
 3570202ceac2b52517df64ebd0a062cb0d8fe33a 644 c
 + hg parents
 changeset:   4:8dfeee82a94b
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 summary:     4
 
-+ hg rawcommit -p 4 -p 5 -d '0 0' -m6
++ hg rawcommit -p 4 -p 5 -d 0 0 -m6
 + hg manifest 6
 d6e3c4976c13feb1728cd3ac851abaf7256a5c23 644 a
 76d5e637cbec1bcc04a5a3fa4bcc7d13f6847c00 644 c
 + hg parents
 changeset:   6:c0e932ecae5e
 tag:         tip
 parent:      4:8dfeee82a94b
 parent:      5:a7925a42d0df
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 summary:     6
 
-+ hg rawcommit -p 6 -d '0 0' -m7
++ hg rawcommit -p 6 -d 0 0 -m7
 + hg manifest 7
 d6e3c4976c13feb1728cd3ac851abaf7256a5c23 644 a
 76d5e637cbec1bcc04a5a3fa4bcc7d13f6847c00 644 c
 + hg parents
 changeset:   7:3a157da4365d
 tag:         tip
 user:        test
 date:        Thu Jan  1 00:00:00 1970
--- a/tests/test-simple-update
+++ b/tests/test-simple-update
@@ -1,11 +1,11 @@
 #!/bin/sh
 
-set -ex
+set -e
 
 mkdir test
 cd test
 echo foo>foo
 hg init
 hg addremove
 hg commit -m "1"
 hg verify
--- a/tests/test-simple-update.out
+++ b/tests/test-simple-update.out
@@ -1,39 +1,32 @@
-+ mkdir test
-+ cd test
-+ echo foo
 + hg init
 + hg addremove
 adding foo
 + hg commit -m 1
 + hg verify
 checking changesets
 checking manifests
 crosschecking files in changesets and manifests
 checking files
 1 files, 1 changesets, 1 total revisions
 + hg clone . ../branch
-+ cd ../branch
 + hg co
-+ echo bar
 + hg commit -m 2
-+ cd ../test
 + hg pull ../branch
 pulling from ../branch
 searching for changes
 adding changesets
 adding manifests
 adding file changes
 added 1 changesets with 1 changes to 1 files
 (run 'hg update' to get a working copy)
 + hg verify
 checking changesets
 checking manifests
 crosschecking files in changesets and manifests
 checking files
 1 files, 2 changesets, 2 total revisions
 + hg co
-+ cat foo
 foo
 bar
 + hg manifest
 6f4310b00b9a147241b071a60c28a650827fb03d 644 foo
--- a/tests/test-tag
+++ b/tests/test-tag
@@ -1,9 +1,9 @@
-#!/bin/sh -x
+#!/bin/sh
 
 hg init
 echo a > a
 hg add a
 hg commit -m "test" -d "0 0"
 hg history
 hg tag -d "0 0" "bleah" 
 hg history
--- a/tests/test-tag.out
+++ b/tests/test-tag.out
@@ -1,31 +1,28 @@
 + hg init
-+ echo a
 + hg add a
-+ hg commit -m test -d '0 0'
++ hg commit -m test -d 0 0
 + hg history
 changeset:   0:acb14030fe0a
 tag:         tip
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 summary:     test
 
-+ hg tag -d '0 0' bleah
++ hg tag -d 0 0 bleah
 + hg history
 changeset:   1:863197ef0378
 tag:         tip
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 summary:     Added tag bleah for changeset acb14030fe0a21b60322c440ad2d20cf7685a376
 
 changeset:   0:acb14030fe0a
 tag:         bleah
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 summary:     test
 
-+ echo foo
-+ hg tag -d '0 0' bleah2
++ hg tag -d 0 0 bleah2
 abort: working copy of .hgtags is changed!
 (please commit .hgtags manually)
-+ echo failed
 failed
--- a/tests/test-tags
+++ b/tests/test-tags
@@ -1,11 +1,10 @@
 #!/bin/sh
 
-set -x
 mkdir t
 cd t
 hg init
 hg id
 echo a > a
 hg add a
 hg commit -m "test" -d "0 0"
 hg co
--- a/tests/test-tags.out
+++ b/tests/test-tags.out
@@ -1,47 +1,39 @@
-+ mkdir t
-+ cd t
 + hg init
 + hg id
 unknown
-+ echo a
 + hg add a
-+ hg commit -m test -d '0 0'
++ hg commit -m test -d 0 0
 + hg co
 + hg identify
 acb14030fe0a tip
-++ hg -q tip
-++ cut -d : -f 2
-+ T=acb14030fe0a21b60322c440ad2d20cf7685a376
-+ echo 'acb14030fe0a21b60322c440ad2d20cf7685a376 first'
-+ cat .hgtags
++ hg -q tip
 acb14030fe0a21b60322c440ad2d20cf7685a376 first
 + hg add .hgtags
-+ hg commit -m 'add tags' -d '0 0'
++ hg commit -m add tags -d 0 0
 + hg tags
-tip                                1:b9154636be938d3d431e75a7c906504a079bfe07
+tip                                1:b53d0e1f3043ecbccf1b9ad2cea562c1b50462b2
 first                              0:acb14030fe0a21b60322c440ad2d20cf7685a376
+hg -q tip                          ?:?
 + hg identify
-b9154636be93 tip
-+ echo bb
+b53d0e1f3043 tip
 + hg status
 M a
 + hg identify
-b9154636be93+ tip
+b53d0e1f3043+ tip
 + hg co first
 + hg id
 acb14030fe0a+ first
 + hg -v id
 acb14030fe0a21b60322c440ad2d20cf7685a376+ first
 + hg status
 M a
-+ echo 1
 + hg add b
-+ hg commit -m branch -d '0 0'
++ hg commit -m branch -d 0 0
 + hg id
 c8edf04160c7 tip
 + hg co -m 1
 + hg id
-c8edf04160c7+b9154636be93+ tip
+c8edf04160c7+b53d0e1f3043+ tip
 + hg status
 M .hgtags
 M a
--- a/tests/test-undo
+++ b/tests/test-undo
@@ -1,11 +1,10 @@
 #!/bin/sh
 
-set -x
 mkdir t
 cd t
 hg init
 echo a > a
 hg add a
 hg commit -m "test" -d "0 0"
 hg verify
 hg parents
--- a/tests/test-undo.out
+++ b/tests/test-undo.out
@@ -1,14 +1,11 @@
-+ mkdir t
-+ cd t
 + hg init
-+ echo a
 + hg add a
-+ hg commit -m test -d '0 0'
++ hg commit -m test -d 0 0
 + hg verify
 checking changesets
 checking manifests
 crosschecking files in changesets and manifests
 checking files
 1 files, 1 changesets, 1 total revisions
 + hg parents
 changeset:   0:acb14030fe0a
--- a/tests/test-unrelated-pull.out
+++ b/tests/test-unrelated-pull.out
@@ -1,16 +1,24 @@
++ hg init
++ hg add a
++ hg commit -m a -u a -d 0 0
++ hg init
++ hg add b
++ hg commit -m b -u b -d 0 0
++ hg pull ../a
 pulling from ../a
 searching for changes
 warning: pulling from an unrelated repository!
 adding changesets
 adding manifests
 adding file changes
 added 1 changesets with 1 changes to 1 files
 (run 'hg update' to get a working copy)
++ hg heads
 changeset:   1:9a79c33a9db3
 tag:         tip
 user:        a
 date:        Thu Jan  1 00:00:00 1970
 summary:     a
 
 changeset:   0:01f8062b2de5
 user:        b
--- a/tests/test-up-local-change
+++ b/tests/test-up-local-change
@@ -1,33 +1,33 @@
 #!/bin/sh
 
-set -ex
+set -e
 mkdir r1
 cd r1
 hg init
 echo a > a
 hg addremove
 hg commit -m "1" -d "0 0"
 
 hg clone . ../r2
 cd ../r2
 hg up
 echo abc > a
 hg diff > ../d
-sed "s/\(\(---\|+++\) [^ \t]*\)[ \t].*/\1/" < ../d
+sed "s/\(\(---\|+++\) [a-zA-Z0-9_/.-]*\).*/\1/" < ../d
 
 cd ../r1
 echo b > b
 echo a2 > a
 hg addremove
 hg commit -m "2" -d "0 0"
 
 cd ../r2
 hg -q pull ../r1
 hg status
 hg --debug up
 hg --debug up -m
 hg parents
 hg -v history
 hg diff > ../d
-sed "s/\(\(---\|+++\) [^ \t]*\)[ \t].*/\1/" < ../d
+sed "s/\(\(---\|+++\) [a-zA-Z0-9_/.-]*\).*/\1/" < ../d
 
--- a/tests/test-up-local-change.out
+++ b/tests/test-up-local-change.out
@@ -1,34 +1,24 @@
-+ mkdir r1
-+ cd r1
 + hg init
-+ echo a
 + hg addremove
 adding a
-+ hg commit -m 1 -d '0 0'
++ hg commit -m 1 -d 0 0
 + hg clone . ../r2
-+ cd ../r2
 + hg up
-+ echo abc
 + hg diff
-+ sed 's/\(\(---\|+++\) [^ \t]*\)[ \t].*/\1/'
 diff -r c19d34741b0a a
 --- a/a
 +++ b/a
 @@ -1,1 +1,1 @@
 -a
 +abc
-+ cd ../r1
-+ echo b
-+ echo a2
 + hg addremove
 adding b
-+ hg commit -m 2 -d '0 0'
-+ cd ../r2
++ hg commit -m 2 -d 0 0
 + hg -q pull ../r1
 + hg status
 M a
 + hg --debug up
 resolving manifests
  force None allow None moddirstate True linear True
  ancestor a0c8bcbbb45c local a0c8bcbbb45c remote 1165e8bd193e
  a versions differ, resolve
@@ -62,15 +52,14 @@ changeset:   0:c19d34741b0a4ced8e4ba74bb
 user:        test
 date:        Thu Jan  1 00:00:00 1970
 files:       a
 description:
 1
 
 
 + hg diff
-+ sed 's/\(\(---\|+++\) [^ \t]*\)[ \t].*/\1/'
 diff -r 1e71731e6fbb a
 --- a/a
 +++ b/a
 @@ -1,1 +1,1 @@
 -a2
 +abc