summaryrefslogtreecommitdiff
path: root/tests/test-mq-qdelete.t
blob: a5fc08f93b89693bead009536516086bbf146b65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
  $ echo "[extensions]" >> $HGRCPATH
  $ echo "mq=" >> $HGRCPATH

  $ hg init a
  $ cd a

  $ echo 'base' > base
  $ hg ci -Ambase -d '1 0'
  adding base

  $ hg qnew -d '1 0' pa
  $ hg qnew -d '1 0' pb
  $ hg qnew -d '1 0' pc

  $ hg qdel
  abort: qdelete requires at least one revision or patch name
  [255]

  $ hg qdel pc
  abort: cannot delete applied patch pc
  [255]

  $ hg qpop
  popping pc
  now at: pb

Delete the same patch twice in one command (issue2427)

  $ hg qdel pc pc

  $ hg qseries
  pa
  pb

  $ ls .hg/patches
  pa
  pb
  series
  status

  $ hg qpop
  popping pb
  now at: pa

  $ hg qdel -k 1

  $ ls .hg/patches
  pa
  pb
  series
  status

  $ hg qdel -r pa
  patch pa finalized without changeset message

  $ hg qapplied

  $ hg log --template '{rev} {desc}\n'
  1 [mq]: pa
  0 base

  $ hg qnew pd
  $ hg qnew pe
  $ hg qnew pf

  $ hg qdel -r pe
  abort: cannot delete revision 3 above applied patches
  [255]

  $ hg qdel -r qbase:pe
  patch pd finalized without changeset message
  patch pe finalized without changeset message

  $ hg qapplied
  pf

  $ hg log --template '{rev} {desc}\n'
  4 [mq]: pf
  3 [mq]: pe
  2 [mq]: pd
  1 [mq]: pa
  0 base

  $ cd ..

  $ hg init b
  $ cd b

  $ echo 'base' > base
  $ hg ci -Ambase -d '1 0'
  adding base

  $ hg qfinish
  abort: no revisions specified
  [255]

  $ hg qfinish -a
  no patches applied

  $ hg qnew -d '1 0' pa
  $ hg qnew -d '1 0' pb
  $ hg qnew pc # XXX fails to apply by /usr/bin/patch if we put a date

  $ hg qfinish 0
  abort: revision 0 is not managed
  [255]

  $ hg qfinish pb
  abort: cannot delete revision 2 above applied patches
  [255]

  $ hg qpop
  popping pc
  now at: pb

  $ hg qfinish -a pc
  abort: unknown revision 'pc'!
  [255]

  $ hg qpush
  applying pc
  patch pc is empty
  now at: pc

  $ hg qfinish qbase:pb
  patch pa finalized without changeset message
  patch pb finalized without changeset message

  $ hg qapplied
  pc

  $ hg log --template '{rev} {desc}\n'
  3 imported patch pc
  2 [mq]: pb
  1 [mq]: pa
  0 base

  $ hg qfinish -a pc
  patch pc finalized without changeset message

  $ hg qapplied

  $ hg log --template '{rev} {desc}\n'
  3 imported patch pc
  2 [mq]: pb
  1 [mq]: pa
  0 base

  $ ls .hg/patches
  series
  status

qdel -k X && hg qimp -e X used to trigger spurious output with versioned queues

  $ hg init --mq
  $ hg qimport -r 3
  $ hg qpop
  popping 3.diff
  patch queue now empty
  $ hg qdel -k 3.diff
  $ hg qimp -e 3.diff
  adding 3.diff to series file
  $ hg qfinish -a
  no patches applied


resilience to inconsistency: qfinish -a with applied patches not in series

  $ hg qser
  3.diff
  $ hg qapplied
  $ hg qpush
  applying 3.diff
  patch 3.diff is empty
  now at: 3.diff
  $ echo next >>  base
  $ hg qrefresh -d '1 0'
  $ echo > .hg/patches/series # remove 3.diff from series to confuse mq
  $ hg qfinish -a
  revision 47dfa8501675 refers to unknown patches: 3.diff

more complex state 'both known and unknown patches

  $ echo hip >>  base
  $ hg qnew -f -d '1 0' -m 4 4.diff
  $ echo hop >>  base
  $ hg qnew -f -d '1 0' -m 5 5.diff
  $ echo > .hg/patches/series # remove 4.diff and 5.diff from series to confuse mq
  $ echo hup >>  base
  $ hg qnew -f -d '1 0' -m 6 6.diff
  $ hg qfinish -a
  revision 2b1c98802260 refers to unknown patches: 5.diff
  revision 33a6861311c0 refers to unknown patches: 4.diff