##// END OF EJS Templates
tests: unify test-mq-qpush-fail
Matt Mackall -
r12467:05e1171c default
parent child Browse files
Show More
@@ -1,62 +1,90 b''
1 #!/bin/sh
2
3 # Test that qpush cleans things up if it doesn't complete
4
5 echo "[extensions]" >> $HGRCPATH
6 echo "mq=" >> $HGRCPATH
7
8 hg init repo
9 cd repo
10
11 echo foo > foo
12 hg ci -Am 'add foo'
1 Test that qpush cleans things up if it doesn't complete
13 2
14 touch untracked-file
15 echo 'syntax: glob' > .hgignore
16 echo '.hgignore' >> .hgignore
17
18 hg qinit
19
20 echo '% test qpush on empty series'
21 hg qpush
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
5 $ hg init repo
6 $ cd repo
7 $ echo foo > foo
8 $ hg ci -Am 'add foo'
9 adding foo
10 $ touch untracked-file
11 $ echo 'syntax: glob' > .hgignore
12 $ echo '.hgignore' >> .hgignore
13 $ hg qinit
22 14
23 hg qnew patch1
24 echo >> foo
25 hg qrefresh -m 'patch 1'
26
27 hg qnew patch2
28 echo bar > bar
29 hg add bar
30 hg qrefresh -m 'patch 2'
15 test qpush on empty series
31 16
32 hg qnew --config 'mq.plain=true' bad-patch
33 echo >> foo
34 hg qrefresh
35
36 hg qpop -a
17 $ hg qpush
18 no patches in series
19 $ hg qnew patch1
20 $ echo >> foo
21 $ hg qrefresh -m 'patch 1'
22 $ hg qnew patch2
23 $ echo bar > bar
24 $ hg add bar
25 $ hg qrefresh -m 'patch 2'
26 $ hg qnew --config 'mq.plain=true' bad-patch
27 $ echo >> foo
28 $ hg qrefresh
29 $ hg qpop -a
30 popping bad-patch
31 popping patch2
32 popping patch1
33 patch queue now empty
34 $ python -c 'print "\xe9"' > message
35 $ cat .hg/patches/bad-patch >> message
36 $ mv message .hg/patches/bad-patch
37 $ hg qpush -a && echo 'qpush succeded?!'
38 applying patch1
39 applying patch2
40 applying bad-patch
41 transaction abort!
42 rollback completed
43 cleaning up working directory...done
44 abort: decoding near '': 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)!
45 [255]
46 $ hg parents
47 changeset: 0:bbd179dfa0a7
48 tag: tip
49 user: test
50 date: Thu Jan 01 00:00:00 1970 +0000
51 summary: add foo
37 52
38 python -c 'print "\xe9"' > message
39 cat .hg/patches/bad-patch >> message
40 mv message .hg/patches/bad-patch
41
42 hg qpush -a && echo 'qpush succeded?!'
43
44 hg parents
45 53
46 echo '% bar should be gone; other unknown/ignored files should still be around'
47 hg status -A
54 bar should be gone; other unknown/ignored files should still be around
55
56 $ hg status -A
57 ? untracked-file
58 I .hgignore
59 C foo
60
61 preparing qpush of a missing patch
62
63 $ hg qpop -a
64 no patches applied
65 $ hg qpush
66 applying patch1
67 now at: patch1
68 $ rm .hg/patches/patch2
69
70 now we expect the push to fail, but it should NOT complain about patch1
48 71
49 echo '% preparing qpush of a missing patch'
50 hg qpop -a
51 hg qpush
52 rm .hg/patches/patch2
53 echo '% now we expect the push to fail, but it should NOT complain about patch1'
54 hg qpush
72 $ hg qpush
73 applying patch2
74 unable to read patch2
75 now at: patch1
76 [1]
77
78 preparing qpush of missing patch with no patch applied
55 79
56 echo '% preparing qpush of missing patch with no patch applied'
57 hg qpop -a
58 rm .hg/patches/patch1
59 echo '% qpush should fail the same way as below'
60 hg qpush
80 $ hg qpop -a
81 popping patch1
82 patch queue now empty
83 $ rm .hg/patches/patch1
61 84
62 true # happy ending
85 qpush should fail the same way as below
86
87 $ hg qpush
88 applying patch1
89 unable to read patch1
90 [1]
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now