tests/test-mq
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Fri, 28 Jul 2006 21:20:41 -0300
changeset 2734 07026da25ed8
parent 2729 8ce86d2c9737
child 2831 0b9ac7dfcf56
permissions -rwxr-xr-x
hbisect.py: don't rely on __del__ to write the current state. This is yet another page of the "Thou shalt not do too much inside __del__ methods" book, in the "demandload and __del__ don't go well together" chapter. The bisect extension is broken in 0.9.1: $ hg bisect init $ hg bisect bad Fatal Python error: Interpreter not initialized (version mismatch?) Aborted (yes, I tripled checked my instalation to make sure the problem is not there) It's been broken since revision fe1689273f84 moved the import of the binascii module into a demandload. (In details: the first time that "hg bisect bad" (or good) is called, there are still no revisions saved in .hg/bisect/*, so bisect.__init__ doesn't call hg.bin on anything. So, when we reach __del__, the binascii module still hasn't been imported and we get that "nice" message above.)

#!/bin/sh

HGRCPATH=$HGTMP/.hgrc; export HGRCPATH
echo "[extensions]" >> $HGTMP/.hgrc
echo "mq=" >> $HGTMP/.hgrc

echo % help
hg help mq

hg init a
cd a
echo a > a
mkdir b
echo z > b/z
hg ci -Ama

echo % qinit

hg qinit

cd ..
hg init b

echo % -R qinit

hg -R b qinit

hg init c

echo % qinit -c

hg --cwd c qinit -c
hg -R c/.hg/patches st

echo % qnew implies add

hg -R c qnew test.patch
hg -R c/.hg/patches st

cd a

echo % qnew -m

hg qnew -m 'foo bar' test.patch
cat .hg/patches/test.patch

echo % qrefresh

echo a >> a
hg qrefresh
sed -e "s/\(^diff -r \)\([a-f0-9]* \)/\1 x/" \
    -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch

echo % qpop

hg qpop

echo % qpush

hg qpush

cd ..

echo % pop/push outside repo

hg -R a qpop
hg -R a qpush

cd a
hg qnew test2.patch

echo % qrefresh in subdir

cd b
echo a > a
hg add a
hg qrefresh

echo % pop/push -a in subdir

hg qpop -a
hg --traceback qpush -a

echo % qseries
hg qseries

echo % qapplied
hg qapplied

echo % qtop
hg qtop

echo % qprev
hg qprev

echo % qnext
hg qnext

echo % pop, qnext, qprev, qapplied
hg qpop
hg qnext
hg qprev
hg qapplied

echo % qunapplied
hg qunapplied

echo % strip
cd ../../b
echo x>x
hg ci -Ama
hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
hg unbundle .hg/strip-backup/*