tests/test-extdiff
author Mads Kiilerich <mads@kiilerich.com>
Tue, 29 Jun 2010 12:12:34 +0200
branchstable
changeset 11488 f786fc4b8764
parent 10775 c52057614c72
permissions -rwxr-xr-x
log: follow filenames through renames (issue647) In commands.log a displayer was initialized from cmdutil.show_changeset() with the initial matchfn (which designates the specified files which only is correct in the highest revision in the range). prep() is handed the correct list of files, but displayer.show() didn't use that list but keept using the original matchfn. The matchfn argument to cmdutil.show_changeset() wasn't specified in other places and is only used in .show(), so now we give the matchfn as an optional parameter to .show(). We do however still have to detect --patch and --stat from opts in show_changeset() and let it imply a matchall, but that can now be overruled with the new .show() matchfn parameter.

#!/bin/sh

echo "[extensions]" >> $HGRCPATH
echo "extdiff=" >> $HGRCPATH

hg init a
cd a
echo a > a
echo b > b
hg add
# should diff cloned directories
hg extdiff -o -r $opt

echo "[extdiff]" >> $HGRCPATH
echo "cmd.falabala=echo" >> $HGRCPATH
echo "opts.falabala=diffing" >> $HGRCPATH

hg falabala

hg help falabala

hg ci -d '0 0' -mtest1

echo b >> a
hg ci -d '1 0' -mtest2

# should diff cloned files directly
hg falabala -r 0:1

# test diff during merge
hg update -C 0
echo c >> c
hg add c
hg ci -m "new branch" -d '1 0'
hg merge 1
# should diff cloned file against wc file
hg falabala > out
# cleanup the output since the wc is a tmp directory
sed  's:\(diffing [^ ]* \).*\(\/test-extdiff\):\1[tmp]\2:' out
# test --change option
hg ci -d '2 0' -mtest3
hg falabala -c 1
# check diff are made from the first parent
hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code"
#hg log

echo
echo '% test extdiff of multiple files in tmp dir:'
hg update -C 0 > /dev/null
echo changed > a
echo changed > b
chmod +x b
echo '% diff in working directory, before'
hg diff --git
echo '% edit with extdiff -p'
# prepare custom diff/edit tool
cat > 'diff tool.py' << EOT
#!/usr/bin/env python
import time
time.sleep(1) # avoid unchanged-timestamp problems
file('a/a', 'ab').write('edited\n')
file('a/b', 'ab').write('edited\n')
EOT
chmod +x 'diff tool.py'
hg extdiff -p "`pwd`/diff tool.py" # will change to /tmp/extdiff.TMP and populate directories a.TMP and a and start tool
echo '% diff in working directory, after'
hg diff --git

echo
echo % test extdiff with --option
hg extdiff -p echo -o this -c 1
hg falabala -o this -c 1
echo