Mercurial > hg
changeset 11896:286693eaba47
tests: unify test-mq-guards
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Sun, 15 Aug 2010 21:58:43 +0900 |
parents | 78e3a70c4445 |
children | 0e4bbe18ff95 |
files | tests/test-mq-eol.t tests/test-mq-guards tests/test-mq-guards.out tests/test-mq-guards.t tests/test-mq.t |
diffstat | 3 files changed, 432 insertions(+), 398 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-mq-guards Sun Aug 15 21:45:31 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -#!/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 does-not-exist.patch +bleh - -echo % should fail -hg qguard +fail - -hg qpush -echo % should guard a.patch -hg qguard +a -echo % should print +a -hg qguard -hg qpop - -echo % should fail -hg qpush a.patch - -hg qguard a.patch -echo % should push b.patch -hg qpush - -hg qpop -echo % test selection of an empty guard -hg qselect "" -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 -echo % should display b.patch -hg qtop - -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 qpush -a -# Used to be an issue with holes in the patch sequence -# So, put one hole on the base and ask for topmost patch. -hg qtop -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 % have at least one patch applied to test coloring -hg qpush -echo % list patches and guards with color -hg --config extensions.color= qguard --config color.mode=ansi \ - -l --color=always -echo % should pop b.patch -hg qpop -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 - -hg qrename a.patch new.patch -echo % should show : -echo % new.patch: +1 +2 -3 -echo % b.patch: +2 -echo % c.patch: unguarded -hg qguard -l - -hg qnew d.patch -hg qpop -echo % should show new.patch and b.patch as Guarded, c.patch as Applied -echo % and d.patch as Unapplied -hg qseries -v -echo % qseries again, but with color -hg --config extensions.color= qseries -v --color=always - -hg qguard d.patch +2 -echo % new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded. -hg qseries -v - -qappunappv() -{ - for command in qapplied "qapplied -v" qunapplied "qunapplied -v"; do - echo % hg $command - hg $command - done -} - -hg qpop -a -hg qguard -l -qappunappv -hg qselect 1 -qappunappv -hg qpush -a -qappunappv -hg qselect 2 -qappunappv - -for patch in `hg qseries`; do - echo % hg qapplied $patch - hg qapplied $patch - echo % hg qunapplied $patch - hg qunapplied $patch -done - -echo % hg qseries -m: only b.patch should be shown -echo the guards file was not ignored in the past -hg qdelete -k b.patch -hg qseries -m -echo % hg qseries -m with color -hg --config extensions.color= qseries -m --color=always
--- a/tests/test-mq-guards.out Sun Aug 15 21:45:31 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,225 +0,0 @@ -adding x -popping c.patch -popping b.patch -popping a.patch -patch queue now empty -% should fail -abort: no patch named does-not-exist.patch -% should fail -abort: no patches applied -applying a.patch -now at: a.patch -% should guard a.patch -% should print +a -a.patch: +a -popping a.patch -patch queue now empty -% should fail -cannot push 'a.patch' - guarded by ['+a'] -a.patch: +a -% should push b.patch -applying b.patch -now at: b.patch -popping b.patch -patch queue now empty -% test selection of an empty guard -abort: guard cannot be an empty string -number of unguarded, unapplied patches has changed from 2 to 3 -% should push a.patch -applying a.patch -now at: a.patch -% should print -a -c.patch: -a -% should skip c.patch -applying b.patch -skipping c.patch - guarded by '-a' -now at: b.patch -% should display b.patch -b.patch -% should push c.patch -applying c.patch -now at: c.patch -popping c.patch -popping b.patch -popping a.patch -patch queue now empty -guards deactivated -number of unguarded, unapplied patches has changed from 3 to 2 -% should push all -applying b.patch -applying c.patch -now at: c.patch -popping c.patch -popping b.patch -patch queue now empty -number of unguarded, unapplied patches has changed from 1 to 2 -% should push a.patch, not b.patch -applying a.patch -now at: a.patch -applying c.patch -now at: c.patch -popping c.patch -popping a.patch -patch queue now empty -% should push b.patch -applying b.patch -now at: b.patch -applying c.patch -now at: c.patch -c.patch -popping c.patch -popping b.patch -patch queue now empty -number of unguarded, unapplied patches has changed from 2 to 3 -% should push a.patch, b.patch -applying a.patch -now at: a.patch -applying b.patch -now at: b.patch -popping b.patch -popping a.patch -patch queue now empty -number of unguarded, unapplied patches has changed from 3 to 2 -% list patches and guards -a.patch: +1 +2 -3 -b.patch: +2 -c.patch: unguarded -% have at least one patch applied to test coloring -applying b.patch -now at: b.patch -% list patches and guards with color -[0;30;1ma.patch[0m: [0;33m+1[0m [0;33m+2[0m [0;31m-3[0m -[0;34;1;4mb.patch[0m: [0;33m+2[0m -[0;30;1mc.patch[0m: [0;32munguarded[0m -% should pop b.patch -popping b.patch -patch queue now empty -% list series -0 G a.patch -1 U b.patch -2 U c.patch -% list guards -1 -2 -3 -% should push b.patch -applying b.patch -now at: b.patch -applying c.patch -now at: c.patch -guards deactivated -popping guarded patches -popping c.patch -popping b.patch -patch queue now empty -reapplying unguarded patches -applying c.patch -now at: c.patch -% guards in series file: +1 +2 -3 -+1 -+2 --3 -% should show c.patch -c.patch -% should show : -% new.patch: +1 +2 -3 -% b.patch: +2 -% c.patch: unguarded -new.patch: +1 +2 -3 -b.patch: +2 -c.patch: unguarded -popping d.patch -now at: c.patch -% should show new.patch and b.patch as Guarded, c.patch as Applied -% and d.patch as Unapplied -0 G new.patch -1 G b.patch -2 A c.patch -3 U d.patch -% qseries again, but with color -0 G [0;30;1mnew.patch[0m -1 G [0;30;1mb.patch[0m -2 A [0;34;1;4mc.patch[0m -3 U [0;30;1md.patch[0m -% new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded. -0 G new.patch -1 G b.patch -2 A c.patch -3 G d.patch -popping c.patch -patch queue now empty -new.patch: +1 +2 -3 -b.patch: +2 -c.patch: unguarded -d.patch: +2 -% hg qapplied -% hg qapplied -v -% hg qunapplied -c.patch -% hg qunapplied -v -0 G new.patch -1 G b.patch -2 U c.patch -3 G d.patch -number of unguarded, unapplied patches has changed from 1 to 2 -% hg qapplied -% hg qapplied -v -% hg qunapplied -new.patch -c.patch -% hg qunapplied -v -0 U new.patch -1 G b.patch -2 U c.patch -3 G d.patch -applying new.patch -skipping b.patch - guarded by ['+2'] -applying c.patch -skipping d.patch - guarded by ['+2'] -now at: c.patch -% hg qapplied -new.patch -c.patch -% hg qapplied -v -0 A new.patch -1 G b.patch -2 A c.patch -% hg qunapplied -% hg qunapplied -v -3 G d.patch -number of unguarded, unapplied patches has changed from 0 to 1 -number of guarded, applied patches has changed from 1 to 0 -% hg qapplied -new.patch -c.patch -% hg qapplied -v -0 A new.patch -1 U b.patch -2 A c.patch -% hg qunapplied -d.patch -% hg qunapplied -v -3 U d.patch -% hg qapplied new.patch -new.patch -% hg qunapplied new.patch -b.patch -d.patch -% hg qapplied b.patch -new.patch -% hg qunapplied b.patch -d.patch -% hg qapplied c.patch -new.patch -c.patch -% hg qunapplied c.patch -d.patch -% hg qapplied d.patch -new.patch -c.patch -% hg qunapplied d.patch -% hg qseries -m: only b.patch should be shown -the guards file was not ignored in the past -b.patch -% hg qseries -m with color -[0;31;1mb.patch[0m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-guards.t Sun Aug 15 21:58:43 2010 +0900 @@ -0,0 +1,432 @@ + $ echo "[extensions]" >> $HGRCPATH + $ echo "mq=" >> $HGRCPATH + + $ hg init + $ hg qinit + + $ echo x > x + $ hg ci -Ama + adding x + + $ 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 + popping c.patch + popping b.patch + popping a.patch + patch queue now empty + + +should fail + + $ hg qguard does-not-exist.patch +bleh + abort: no patch named does-not-exist.patch + + +should fail + + $ hg qguard +fail + abort: no patches applied + + $ hg qpush + applying a.patch + now at: a.patch + +should guard a.patch + + $ hg qguard +a + +should print +a + + $ hg qguard + a.patch: +a + $ hg qpop + popping a.patch + patch queue now empty + + +should fail + + $ hg qpush a.patch + cannot push 'a.patch' - guarded by ['+a'] + + $ hg qguard a.patch + a.patch: +a + +should push b.patch + + $ hg qpush + applying b.patch + now at: b.patch + + $ hg qpop + popping b.patch + patch queue now empty + +test selection of an empty guard + + $ hg qselect "" + abort: guard cannot be an empty string + $ hg qselect a + number of unguarded, unapplied patches has changed from 2 to 3 + +should push a.patch + + $ hg qpush + applying a.patch + now at: a.patch + + $ hg qguard -- c.patch -a + +should print -a + + $ hg qguard c.patch + c.patch: -a + + +should skip c.patch + + $ hg qpush -a + applying b.patch + skipping c.patch - guarded by '-a' + now at: b.patch + +should display b.patch + + $ hg qtop + b.patch + + $ hg qguard -n c.patch + +should push c.patch + + $ hg qpush -a + applying c.patch + now at: c.patch + + $ hg qpop -a + popping c.patch + popping b.patch + popping a.patch + patch queue now empty + $ hg qselect -n + guards deactivated + number of unguarded, unapplied patches has changed from 3 to 2 + +should push all + + $ hg qpush -a + applying b.patch + applying c.patch + now at: c.patch + + $ hg qpop -a + popping c.patch + popping b.patch + patch queue now empty + $ hg qguard a.patch +1 + $ hg qguard b.patch +2 + $ hg qselect 1 + number of unguarded, unapplied patches has changed from 1 to 2 + +should push a.patch, not b.patch + + $ hg qpush + applying a.patch + now at: a.patch + $ hg qpush + applying c.patch + now at: c.patch + $ hg qpop -a + popping c.patch + popping a.patch + patch queue now empty + + $ hg qselect 2 + +should push b.patch + + $ hg qpush + applying b.patch + now at: b.patch + $ hg qpush -a + applying c.patch + now at: c.patch + +Used to be an issue with holes in the patch sequence +So, put one hole on the base and ask for topmost patch. + + $ hg qtop + c.patch + $ hg qpop -a + popping c.patch + popping b.patch + patch queue now empty + + $ hg qselect 1 2 + number of unguarded, unapplied patches has changed from 2 to 3 + +should push a.patch, b.patch + + $ hg qpush + applying a.patch + now at: a.patch + $ hg qpush + applying b.patch + now at: b.patch + $ hg qpop -a + popping b.patch + popping a.patch + patch queue now empty + + $ hg qguard -- a.patch +1 +2 -3 + $ hg qselect 1 2 3 + number of unguarded, unapplied patches has changed from 3 to 2 + + +list patches and guards + + $ hg qguard -l + a.patch: +1 +2 -3 + b.patch: +2 + c.patch: unguarded + +have at least one patch applied to test coloring + + $ hg qpush + applying b.patch + now at: b.patch + +list patches and guards with color + + $ hg --config extensions.color= qguard --config color.mode=ansi \ + > -l --color=always + [0;30;1ma.patch[0m: [0;33m+1[0m [0;33m+2[0m [0;31m-3[0m + [0;34;1;4mb.patch[0m: [0;33m+2[0m + [0;30;1mc.patch[0m: [0;32munguarded[0m + +should pop b.patch + + $ hg qpop + popping b.patch + patch queue now empty + +list series + + $ hg qseries -v + 0 G a.patch + 1 U b.patch + 2 U c.patch + +list guards + + $ hg qselect + 1 + 2 + 3 + +should push b.patch + + $ hg qpush + applying b.patch + now at: b.patch + + $ hg qpush -a + applying c.patch + now at: c.patch + $ hg qselect -n --reapply + guards deactivated + popping guarded patches + popping c.patch + popping b.patch + patch queue now empty + reapplying unguarded patches + applying c.patch + now at: c.patch + +guards in series file: +1 +2 -3 + + $ hg qselect -s + +1 + +2 + -3 + +should show c.patch + + $ hg qapplied + c.patch + + $ hg qrename a.patch new.patch + +should show : + + +new.patch: +1 +2 -3 + + +b.patch: +2 + + +c.patch: unguarded + + $ hg qguard -l + new.patch: +1 +2 -3 + b.patch: +2 + c.patch: unguarded + + $ hg qnew d.patch + $ hg qpop + popping d.patch + now at: c.patch + +should show new.patch and b.patch as Guarded, c.patch as Applied + + +and d.patch as Unapplied + + $ hg qseries -v + 0 G new.patch + 1 G b.patch + 2 A c.patch + 3 U d.patch + +qseries again, but with color + + $ hg --config extensions.color= qseries -v --color=always + 0 G [0;30;1mnew.patch[0m + 1 G [0;30;1mb.patch[0m + 2 A [0;34;1;4mc.patch[0m + 3 U [0;30;1md.patch[0m + + $ hg qguard d.patch +2 + +new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded. + + $ hg qseries -v + 0 G new.patch + 1 G b.patch + 2 A c.patch + 3 G d.patch + + $ qappunappv() + > { + > for command in qapplied "qapplied -v" qunapplied "qunapplied -v"; do + > echo % hg $command + > hg $command + > done + > } + + $ hg qpop -a + popping c.patch + patch queue now empty + $ hg qguard -l + new.patch: +1 +2 -3 + b.patch: +2 + c.patch: unguarded + d.patch: +2 + $ qappunappv + % hg qapplied + % hg qapplied -v + % hg qunapplied + c.patch + % hg qunapplied -v + 0 G new.patch + 1 G b.patch + 2 U c.patch + 3 G d.patch + $ hg qselect 1 + number of unguarded, unapplied patches has changed from 1 to 2 + $ qappunappv + % hg qapplied + % hg qapplied -v + % hg qunapplied + new.patch + c.patch + % hg qunapplied -v + 0 U new.patch + 1 G b.patch + 2 U c.patch + 3 G d.patch + $ hg qpush -a + applying new.patch + skipping b.patch - guarded by ['+2'] + applying c.patch + skipping d.patch - guarded by ['+2'] + now at: c.patch + $ qappunappv + % hg qapplied + new.patch + c.patch + % hg qapplied -v + 0 A new.patch + 1 G b.patch + 2 A c.patch + % hg qunapplied + % hg qunapplied -v + 3 G d.patch + $ hg qselect 2 + number of unguarded, unapplied patches has changed from 0 to 1 + number of guarded, applied patches has changed from 1 to 0 + $ qappunappv + % hg qapplied + new.patch + c.patch + % hg qapplied -v + 0 A new.patch + 1 U b.patch + 2 A c.patch + % hg qunapplied + d.patch + % hg qunapplied -v + 3 U d.patch + + $ for patch in `hg qseries`; do + > echo % hg qapplied $patch + > hg qapplied $patch + > echo % hg qunapplied $patch + > hg qunapplied $patch + > done + % hg qapplied new.patch + new.patch + % hg qunapplied new.patch + b.patch + d.patch + % hg qapplied b.patch + new.patch + % hg qunapplied b.patch + d.patch + % hg qapplied c.patch + new.patch + c.patch + % hg qunapplied c.patch + d.patch + % hg qapplied d.patch + new.patch + c.patch + % hg qunapplied d.patch + + +hg qseries -m: only b.patch should be shown +the guards file was not ignored in the past + + $ hg qdelete -k b.patch + $ hg qseries -m + b.patch + +hg qseries -m with color + + $ hg --config extensions.color= qseries -m --color=always + [0;31;1mb.patch[0m