view tests/test-backout @ 3347:25d270e0b27f

ui.py: untangle updateopts The code in ui.updateopts that handles ui.quiet, ui.verbose and ui.debugflag is too smart, making it somewhat hard to see what are the exact constraints placed on the values of these variables, hiding some buglets. This patch makes these constraints more explicit, fixing these buglets and changing the behaviour slightly. It also adds a test to make sure things work as expected in the future. The buglets: - setting ui.debug = True in a hgrc wouldn't turn on verbose mode - additionally, setting ui.quiet = True or using --quiet would give you a "quiet debug" mode. The behaviour change: - previously, in a hgrc file, ui.quiet wins against ui.verbose (i.e. the final result would be quiet mode), but --verbose wins against --quiet - now ui.quiet nullifies ui.verbose and --verbose nullifies --quiet. As a consequence, using -qv always gives you normal mode (unless debug mode was turned on somewhere)
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Tue, 10 Oct 2006 18:43:20 -0300
parents 8ba1c31f6864
children 46280c004f22
line wrap: on
line source

#!/bin/sh

echo '# basic operation'
hg init basic
cd basic
echo a > a
hg commit -d '0 0' -A -m a
echo b >> a
hg commit -d '1 0' -m b

hg backout -d '2 0' tip
cat a

echo '# file that was removed is recreated'
cd ..
hg init remove
cd remove

echo content > a
hg commit -d '0 0' -A -m a

hg rm a
hg commit -d '1 0' -m b

hg backout -d '2 0' --merge tip
cat a

echo '# backout of backout is as if nothing happened'

hg backout -d '3 0' --merge tip
cat a 2>/dev/null || echo cat: a: No such file or directory

echo '# backout with merge'
cd ..
hg init merge
cd merge

echo line 1 > a
hg commit -d '0 0' -A -m a

echo line 2 >> a
hg commit -d '1 0' -m b

echo line 3 >> a
hg commit -d '2 0' -m c

hg backout --merge -d '3 0' 1
hg commit -d '4 0' -m d
cat a

echo '# backout should not back out subsequent changesets'
hg init onecs
cd onecs
echo 1 > a
hg commit -d '0 0' -A -m a
echo 2 >> a
hg commit -d '1 0' -m b
echo 1 > b
hg commit -d '2 0' -A -m c
hg backout -d '3 0' 1
hg locate b

cd ..
hg init m
cd m
echo a > a
hg commit -d '0 0' -A -m a
echo b > b
hg commit -d '1 0' -A -m b
echo c > c
hg commit -d '2 0' -A -m b
hg update 1
echo d > d
hg commit -d '3 0' -A -m c
hg merge 2
hg commit -d '4 0' -A -m d

echo '# backout of merge should fail'

hg backout 4

echo '# backout of merge with bad parent should fail'

hg backout --parent 0 4

echo '# backout of non-merge with parent should fail'

hg backout --parent 0 3

echo '# backout with valid parent should be ok'

hg backout -d '5 0' --parent 2 4

hg rollback
hg update -C

hg backout -d '6 0' --parent 3 4

exit 0