Mercurial > hg > mercurial-crew-with-dirclash
view tests/test-mq-guards @ 4100:c30c922f907a
Modify qpush/qpop idempotent operations to return success
Modify qpush/qpop such that idempotent instances of the operations
return success. That is, repeated qpush -a, qpop -a, qpush patch-name
or qpop patch-name will return success. The end goal of each of these
operations is to reach a particular state. Whether or not the patches
were already applied does not affect that state or operation status.
Likewise, be careful to retain the error status on a qpush/qpop
without arguments when the end/beginning of the series has been
reached.
author | Ben Thomas <bthomas@virtualiron.com> |
---|---|
date | Tue, 13 Feb 2007 08:54:48 -0500 |
parents | 955475d237fc |
children | a9ee6c53af8d |
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 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 hg qguard d.patch +2 echo % new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded. hg qseries -v