view tests/test-mq-guards @ 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 61fcd9fac434
children 193e9c6d1a6d
line wrap: on
line source

#!/bin/sh

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

hg init
hg qinit

echo x > x
hg ci -Ama

hg qnew a.patch
echo a > a
hg add a
hg qrefresh

hg qnew b.patch
echo b > b
hg add b
hg qrefresh

hg qnew c.patch
echo c > c
hg add c
hg qrefresh

hg qpop -a

echo % should fail
hg qguard +fail

hg qpush
echo % should guard a.patch
hg qguard +a
echo % should print +a
hg qguard
hg qpop

hg qguard a.patch
echo % should push b.patch
hg qpush

hg qpop
hg qselect a
echo % should push a.patch
hg qpush

hg qguard c.patch -a
echo % should print -a
hg qguard c.patch

echo % should skip c.patch
hg qpush -a

hg qguard -n c.patch
echo % should push c.patch
hg qpush -a

hg qpop -a
hg qselect -n
echo % should push all
hg qpush -a

hg qpop -a
hg qguard a.patch +1
hg qguard b.patch +2
hg qselect 1
echo % should push a.patch, not b.patch
hg qpush
hg qpush
hg qpop -a

hg qselect 2
echo % should push b.patch
hg qpush
hg qpop -a

hg qselect 1 2
echo % should push a.patch, b.patch
hg qpush
hg qpush
hg qpop -a

hg qguard a.patch +1 +2 -3
hg qselect 1 2 3
echo % list patches and guards
hg qguard -l
echo % list series
hg qseries -v
echo % list guards
hg qselect
echo % should push b.patch
hg qpush

hg qpush -a
hg qselect -n --reapply
echo % guards in series file: +1 +2 -3
hg qselect -s
echo % should show c.patch
hg qapplied