tests/test-mq-qpush-fail
author Greg Ward <greg-hg@gerg.ca>
Mon, 05 Oct 2009 18:17:13 -0400
changeset 9547 f57640bf10d4
parent 8875 801cacf46e62
child 9590 07a62819b309
permissions -rwxr-xr-x
cmdutil: changeset_printer: use methods of filectx/changectx. This allows extensions that modify changeset metadata (e.g. description) by overriding methods of changectx to get consistent behavior from all log-like commands, regardless of whether templates or styles are used. Without this, overriding changectx methods works if you use styles or templates, but not with default log format. This meant adding filectx.extra() for consistency with changectx.

#!/bin/sh

# Test that qpush cleans things up if it doesn't complete

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

hg init repo
cd repo

echo foo > foo
hg ci -Am 'add foo'

touch untracked-file
echo 'syntax: glob' > .hgignore
echo '.hgignore' >> .hgignore

hg qinit

echo '% test qpush on empty series'
hg qpush

hg qnew patch1
echo >> foo
hg qrefresh -m 'patch 1'

hg qnew patch2
echo bar > bar
hg add bar
hg qrefresh -m 'patch 2'

hg qnew bad-patch
echo >> foo
hg qrefresh

hg qpop -a

python -c 'print "\xe9"' > message
cat .hg/patches/bad-patch >> message
mv message .hg/patches/bad-patch

hg qpush -a && echo 'qpush succeded?!'

hg parents

echo '% bar should be gone; other unknown/ignored files should still be around'
hg status -A

echo '% preparing qpush of a missing patch'
hg qpop -a
hg qpush
rm .hg/patches/patch2
echo '% now we expect the push to fail, but it should NOT complain about patch1'
hg qpush

true # happy ending