# HG changeset patch # User Alexis S. L. Carvalho # Date 1171695006 7200 # Node ID e2ed92f4c0f759fe2a2803853bfcb92f135d85c5 # Parent c30c922f907a618351cbc7884cbdb1b3314257e7 add some tests for qpush/qpop error codes diff --git a/tests/test-mq b/tests/test-mq --- a/tests/test-mq +++ b/tests/test-mq @@ -169,6 +169,46 @@ echo % push should succeed hg qpop -a hg push ../../k +echo % qpush/qpop error codes +errorcode() +{ + hg "$@" && echo " $@ succeeds" || echo " $@ fails" +} + +# we want to start with some patches applied +hg qpush -a +echo " % pops all patches and succeeds" +errorcode qpop -a +echo " % does nothing and succeeds" +errorcode qpop -a +echo " % fails - nothing else to pop" +errorcode qpop +echo " % pushes a patch and succeeds" +errorcode qpush +echo " % pops a patch and succeeds" +errorcode qpop +echo " % pushes up to test1b.patch and succeeds" +errorcode qpush test1b.patch +echo " % does nothing and succeeds" +errorcode qpush test1b.patch +echo " % does nothing and succeeds" +errorcode qpop test1b.patch +echo " % fails - can't push to this patch" +errorcode qpush test.patch +echo " % fails - can't pop to this patch" +errorcode qpop test2.patch +echo " % pops up to test.patch and succeeds" +errorcode qpop test.patch +echo " % pushes all patches and succeeds" +errorcode qpush -a +echo " % does nothing and succeeds" +errorcode qpush -a +echo " % fails - nothing else to push" +errorcode qpush +echo " % does nothing and succeeds" +errorcode qpush test2.patch + + echo % strip cd ../../b echo x>x diff --git a/tests/test-mq.out b/tests/test-mq.out --- a/tests/test-mq.out +++ b/tests/test-mq.out @@ -156,6 +156,61 @@ adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files +% qpush/qpop error codes +applying test.patch +applying test1b.patch +applying test2.patch +Now at: test2.patch + % pops all patches and succeeds +Patch queue now empty + qpop -a succeeds + % does nothing and succeeds +no patches applied + qpop -a succeeds + % fails - nothing else to pop +no patches applied + qpop fails + % pushes a patch and succeeds +applying test.patch +Now at: test.patch + qpush succeeds + % pops a patch and succeeds +Patch queue now empty + qpop succeeds + % pushes up to test1b.patch and succeeds +applying test.patch +applying test1b.patch +Now at: test1b.patch + qpush test1b.patch succeeds + % does nothing and succeeds +qpush: test1b.patch is already at the top + qpush test1b.patch succeeds + % does nothing and succeeds +qpop: test1b.patch is already at the top + qpop test1b.patch succeeds + % fails - can't push to this patch +abort: cannot push to a previous patch: test.patch + qpush test.patch fails + % fails - can't pop to this patch +abort: patch test2.patch is not applied + qpop test2.patch fails + % pops up to test.patch and succeeds +Now at: test.patch + qpop test.patch succeeds + % pushes all patches and succeeds +applying test1b.patch +applying test2.patch +Now at: test2.patch + qpush -a succeeds + % does nothing and succeeds +all patches are currently applied + qpush -a succeeds + % fails - nothing else to push +patch series already fully applied + qpush fails + % does nothing and succeeds +all patches are currently applied + qpush test2.patch succeeds % strip adding x 0 files updated, 0 files merged, 1 files removed, 0 files unresolved