# HG changeset patch # User Nicolas Dumazet # Date 2010-08-15 13:44:15 # Node ID 7dc8b9e25f1946fe400bc0f354b7408fd96cbde3 # Parent 0e4bbe18ff955db782ff64ad82d7282f6a9d6d95 tests: unify test-mq-safety diff --git a/tests/test-mq-safety.out b/tests/test-mq-safety.out deleted file mode 100644 --- a/tests/test-mq-safety.out +++ /dev/null @@ -1,47 +0,0 @@ -% try to commit on top of a patch -abort: cannot commit over an applied mq patch -% qpop/qrefresh on the wrong revision -abort: popping would remove a revision not managed by this patch queue -using patch queue: -abort: popping would remove a revision not managed by this patch queue -abort: working directory revision is not qtip -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -% qpop -abort: popping would remove a revision not managed by this patch queue -% qrefresh -abort: cannot refresh a revision with children -% tip: -3 append quux -% qpush warning branchheads -popping qp -patch queue now empty -adding a -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -marked working directory as branch b -adding c -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -(branch merge, don't forget to commit) -0 files updated, 0 files merged, 1 files removed, 0 files unresolved -changeset: 2:65309210bf4e -branch: b -tag: tip -parent: 1:707adb4c8ae1 -parent: 0:cb9a9f314b8b -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: merge - -changeset: 1:707adb4c8ae1 -branch: b -parent: -1:000000000000 -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: c - -changeset: 0:cb9a9f314b8b -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: a - -applying qp -now at: qp diff --git a/tests/test-mq-safety b/tests/test-mq-safety.t old mode 100755 new mode 100644 rename from tests/test-mq-safety rename to tests/test-mq-safety.t --- a/tests/test-mq-safety +++ b/tests/test-mq-safety.t @@ -1,64 +1,106 @@ -#!/bin/sh + $ echo '[extensions]' >> $HGRCPATH + $ echo 'mq =' >> $HGRCPATH -echo '[extensions]' >> $HGRCPATH -echo 'mq =' >> $HGRCPATH + $ hg init repo + $ cd repo + + $ echo foo > foo + $ hg ci -qAm 'add a file' + + $ hg qinit -hg init repo -cd repo + $ hg qnew foo + $ echo foo >> foo + $ hg qrefresh -m 'append foo' -echo foo > foo -hg ci -qAm 'add a file' + $ hg qnew bar + $ echo bar >> foo + $ hg qrefresh -m 'append bar' + -hg qinit +try to commit on top of a patch + + $ echo quux >> foo + $ hg ci -m 'append quux' + abort: cannot commit over an applied mq patch -hg qnew foo -echo foo >> foo -hg qrefresh -m 'append foo' + +cheat a bit... -hg qnew bar -echo bar >> foo -hg qrefresh -m 'append bar' + $ mv .hg/patches .hg/patches2 + $ hg ci -m 'append quux' + $ mv .hg/patches2 .hg/patches + + +qpop/qrefresh on the wrong revision -echo '% try to commit on top of a patch' -echo quux >> foo -hg ci -m 'append quux' + $ hg qpop + abort: popping would remove a revision not managed by this patch queue + $ hg qpop -n patches 2>&1 | sed -e 's/\(using patch queue:\).*/\1/' + using patch queue: + abort: popping would remove a revision not managed by this patch queue + $ hg qrefresh + abort: working directory revision is not qtip -# cheat a bit... -mv .hg/patches .hg/patches2 -hg ci -m 'append quux' -mv .hg/patches2 .hg/patches + $ hg up -C qtip + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg qpop + abort: popping would remove a revision not managed by this patch queue + $ hg qrefresh + abort: cannot refresh a revision with children + $ hg tip --template '{rev} {desc}\n' + 3 append quux -echo '% qpop/qrefresh on the wrong revision' -hg qpop -hg qpop -n patches 2>&1 | sed -e 's/\(using patch queue:\).*/\1/' -hg qrefresh -hg up -C qtip -echo '% qpop' -hg qpop - -echo '% qrefresh' -hg qrefresh - -echo '% tip:' -hg tip --template '{rev} {desc}\n' +qpush warning branchheads -echo '% qpush warning branchheads' -cd .. -hg init branchy -cd branchy -echo q > q -hg add q -hg qnew -f qp -hg qpop -echo a > a -hg ci -Ama -hg up null -hg branch b -echo c > c -hg ci -Amc -hg merge default -hg ci -mmerge -hg up default -hg log -hg qpush + $ cd .. + $ hg init branchy + $ cd branchy + $ echo q > q + $ hg add q + $ hg qnew -f qp + $ hg qpop + popping qp + patch queue now empty + $ echo a > a + $ hg ci -Ama + adding a + $ hg up null + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg branch b + marked working directory as branch b + $ echo c > c + $ hg ci -Amc + adding c + $ hg merge default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg ci -mmerge + $ hg up default + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg log + changeset: 2:65309210bf4e + branch: b + tag: tip + parent: 1:707adb4c8ae1 + parent: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: merge + + changeset: 1:707adb4c8ae1 + branch: b + parent: -1:000000000000 + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: c + + changeset: 0:cb9a9f314b8b + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + + $ hg qpush + applying qp + now at: qp