# HG changeset patch # User Alexis S. L. Carvalho # Date 1182396854 10800 # Node ID 17f5d2069551ee62d2b0616ce3451a5f84e746f1 # Parent 27a386b96557c27443d3257c91d44f77aab3698b mq: test that qpush cleans things up when it fails diff --git a/tests/test-mq-qpush-fail b/tests/test-mq-qpush-fail new file mode 100755 --- /dev/null +++ b/tests/test-mq-qpush-fail @@ -0,0 +1,43 @@ +#!/bin/sh + +# Test that qpush cleans things up if it doesn't complete + +echo "[extensions]" >> $HGRCPATH +echo "mq=" >> $HGRCPATH + +hg init repo +cd repo + +echo foo > foo +hg ci -Am 'add foo' -d '0 0' + +touch untracked-file +echo 'syntax: glob' > .hgignore +echo '.hgignore' >> .hgignore + +hg qinit +hg qnew patch1 +echo >> foo +hg qrefresh -m 'patch 1' + +hg qnew patch2 +echo bar > bar +hg add bar +hg qrefresh -m 'patch 2' + +hg qnew bad-patch +echo >> foo +hg qrefresh + +hg qpop -a + +python -c 'print "\xe9"' > message +cat .hg/patches/bad-patch >> message +mv message .hg/patches/bad-patch + +hg qpush -a && echo 'qpush succeded?!' + +hg parents + +echo '% bar should be gone; other unknown/ignored files should still be around' +hg status -A diff --git a/tests/test-mq-qpush-fail.out b/tests/test-mq-qpush-fail.out new file mode 100644 --- /dev/null +++ b/tests/test-mq-qpush-fail.out @@ -0,0 +1,19 @@ +adding foo +Patch queue now empty +applying patch1 +applying patch2 +applying bad-patch +transaction abort! +rollback completed +cleaning up working directory...done +abort: decoding near 'é': 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)! +changeset: 0:bbd179dfa0a7 +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: add foo + +% bar should be gone; other unknown/ignored files should still be around +? untracked-file +I .hgignore +C foo