##// END OF EJS Templates
test-histedit-edit.t: demonstrate qnew fails during a histedit (issue4366)...
Augie Fackler -
r24299:68d998a7 default
parent child Browse files
Show More
@@ -1,364 +1,371
1 $ . "$TESTDIR/histedit-helpers.sh"
1 $ . "$TESTDIR/histedit-helpers.sh"
2
2
3 $ cat >> $HGRCPATH <<EOF
3 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
4 > [extensions]
5 > histedit=
5 > histedit=
6 > strip=
6 > strip=
7 > EOF
7 > EOF
8
8
9 $ initrepo ()
9 $ initrepo ()
10 > {
10 > {
11 > hg init r
11 > hg init r
12 > cd r
12 > cd r
13 > for x in a b c d e f g; do
13 > for x in a b c d e f g; do
14 > echo $x > $x
14 > echo $x > $x
15 > hg add $x
15 > hg add $x
16 > hg ci -m $x
16 > hg ci -m $x
17 > done
17 > done
18 > }
18 > }
19
19
20 $ initrepo
20 $ initrepo
21
21
22 log before edit
22 log before edit
23 $ hg log --graph
23 $ hg log --graph
24 @ changeset: 6:3c6a8ed2ebe8
24 @ changeset: 6:3c6a8ed2ebe8
25 | tag: tip
25 | tag: tip
26 | user: test
26 | user: test
27 | date: Thu Jan 01 00:00:00 1970 +0000
27 | date: Thu Jan 01 00:00:00 1970 +0000
28 | summary: g
28 | summary: g
29 |
29 |
30 o changeset: 5:652413bf663e
30 o changeset: 5:652413bf663e
31 | user: test
31 | user: test
32 | date: Thu Jan 01 00:00:00 1970 +0000
32 | date: Thu Jan 01 00:00:00 1970 +0000
33 | summary: f
33 | summary: f
34 |
34 |
35 o changeset: 4:e860deea161a
35 o changeset: 4:e860deea161a
36 | user: test
36 | user: test
37 | date: Thu Jan 01 00:00:00 1970 +0000
37 | date: Thu Jan 01 00:00:00 1970 +0000
38 | summary: e
38 | summary: e
39 |
39 |
40 o changeset: 3:055a42cdd887
40 o changeset: 3:055a42cdd887
41 | user: test
41 | user: test
42 | date: Thu Jan 01 00:00:00 1970 +0000
42 | date: Thu Jan 01 00:00:00 1970 +0000
43 | summary: d
43 | summary: d
44 |
44 |
45 o changeset: 2:177f92b77385
45 o changeset: 2:177f92b77385
46 | user: test
46 | user: test
47 | date: Thu Jan 01 00:00:00 1970 +0000
47 | date: Thu Jan 01 00:00:00 1970 +0000
48 | summary: c
48 | summary: c
49 |
49 |
50 o changeset: 1:d2ae7f538514
50 o changeset: 1:d2ae7f538514
51 | user: test
51 | user: test
52 | date: Thu Jan 01 00:00:00 1970 +0000
52 | date: Thu Jan 01 00:00:00 1970 +0000
53 | summary: b
53 | summary: b
54 |
54 |
55 o changeset: 0:cb9a9f314b8b
55 o changeset: 0:cb9a9f314b8b
56 user: test
56 user: test
57 date: Thu Jan 01 00:00:00 1970 +0000
57 date: Thu Jan 01 00:00:00 1970 +0000
58 summary: a
58 summary: a
59
59
60
60
61 edit the history
61 edit the history
62 $ hg histedit 177f92b77385 --commands - 2>&1 << EOF| fixbundle
62 $ hg histedit 177f92b77385 --commands - 2>&1 << EOF| fixbundle
63 > pick 177f92b77385 c
63 > pick 177f92b77385 c
64 > pick 055a42cdd887 d
64 > pick 055a42cdd887 d
65 > edit e860deea161a e
65 > edit e860deea161a e
66 > pick 652413bf663e f
66 > pick 652413bf663e f
67 > pick 3c6a8ed2ebe8 g
67 > pick 3c6a8ed2ebe8 g
68 > EOF
68 > EOF
69 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
69 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
70 Make changes as needed, you may commit or record as needed now.
70 Make changes as needed, you may commit or record as needed now.
71 When you are finished, run hg histedit --continue to resume.
71 When you are finished, run hg histedit --continue to resume.
72
72
73 edit the plan
73 edit the plan
74 $ hg histedit --edit-plan --commands - 2>&1 << EOF
74 $ hg histedit --edit-plan --commands - 2>&1 << EOF
75 > edit e860deea161a e
75 > edit e860deea161a e
76 > pick 652413bf663e f
76 > pick 652413bf663e f
77 > drop 3c6a8ed2ebe8 g
77 > drop 3c6a8ed2ebe8 g
78 > EOF
78 > EOF
79
79
80 Go at a random point and try to continue
80 Go at a random point and try to continue
81
81
82 $ hg id -n
82 $ hg id -n
83 3+
83 3+
84 $ hg up 0
84 $ hg up 0
85 abort: histedit in progress
85 abort: histedit in progress
86 (use 'hg histedit --continue' or 'hg histedit --abort')
86 (use 'hg histedit --continue' or 'hg histedit --abort')
87 [255]
87 [255]
88
88
89 Try to delete necessary commit
89 Try to delete necessary commit
90 $ hg strip -r 652413bf663e
90 $ hg strip -r 652413bf663e
91 abort: histedit in progress, can't strip 363532343133
91 abort: histedit in progress, can't strip 363532343133
92 [255]
92 [255]
93
93
94 commit, then edit the revision
94 commit, then edit the revision
95 $ hg ci -m 'wat'
95 $ hg ci -m 'wat'
96 created new head
96 created new head
97 $ echo a > e
97 $ echo a > e
98
99 qnew should fail while we're in the middle of the edit step
100
101 $ hg --config extensions.mq= qnew please-fail
102 abort: histedit in progress
103 (use 'hg histedit --continue' or 'hg histedit --abort')
104 [255]
98 $ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle
105 $ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle
99 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
101
108
102 $ hg log --graph
109 $ hg log --graph
103 @ changeset: 6:b5f70786f9b0
110 @ changeset: 6:b5f70786f9b0
104 | tag: tip
111 | tag: tip
105 | user: test
112 | user: test
106 | date: Thu Jan 01 00:00:00 1970 +0000
113 | date: Thu Jan 01 00:00:00 1970 +0000
107 | summary: f
114 | summary: f
108 |
115 |
109 o changeset: 5:a5e1ba2f7afb
116 o changeset: 5:a5e1ba2f7afb
110 | user: test
117 | user: test
111 | date: Thu Jan 01 00:00:00 1970 +0000
118 | date: Thu Jan 01 00:00:00 1970 +0000
112 | summary: foobaz
119 | summary: foobaz
113 |
120 |
114 o changeset: 4:1a60820cd1f6
121 o changeset: 4:1a60820cd1f6
115 | user: test
122 | user: test
116 | date: Thu Jan 01 00:00:00 1970 +0000
123 | date: Thu Jan 01 00:00:00 1970 +0000
117 | summary: wat
124 | summary: wat
118 |
125 |
119 o changeset: 3:055a42cdd887
126 o changeset: 3:055a42cdd887
120 | user: test
127 | user: test
121 | date: Thu Jan 01 00:00:00 1970 +0000
128 | date: Thu Jan 01 00:00:00 1970 +0000
122 | summary: d
129 | summary: d
123 |
130 |
124 o changeset: 2:177f92b77385
131 o changeset: 2:177f92b77385
125 | user: test
132 | user: test
126 | date: Thu Jan 01 00:00:00 1970 +0000
133 | date: Thu Jan 01 00:00:00 1970 +0000
127 | summary: c
134 | summary: c
128 |
135 |
129 o changeset: 1:d2ae7f538514
136 o changeset: 1:d2ae7f538514
130 | user: test
137 | user: test
131 | date: Thu Jan 01 00:00:00 1970 +0000
138 | date: Thu Jan 01 00:00:00 1970 +0000
132 | summary: b
139 | summary: b
133 |
140 |
134 o changeset: 0:cb9a9f314b8b
141 o changeset: 0:cb9a9f314b8b
135 user: test
142 user: test
136 date: Thu Jan 01 00:00:00 1970 +0000
143 date: Thu Jan 01 00:00:00 1970 +0000
137 summary: a
144 summary: a
138
145
139
146
140 $ hg cat e
147 $ hg cat e
141 a
148 a
142
149
143 check histedit_source
150 check histedit_source
144
151
145 $ hg log --debug --rev 5
152 $ hg log --debug --rev 5
146 changeset: 5:a5e1ba2f7afb899ef1581cea528fd885d2fca70d
153 changeset: 5:a5e1ba2f7afb899ef1581cea528fd885d2fca70d
147 phase: draft
154 phase: draft
148 parent: 4:1a60820cd1f6004a362aa622ebc47d59bc48eb34
155 parent: 4:1a60820cd1f6004a362aa622ebc47d59bc48eb34
149 parent: -1:0000000000000000000000000000000000000000
156 parent: -1:0000000000000000000000000000000000000000
150 manifest: 5:5ad3be8791f39117565557781f5464363b918a45
157 manifest: 5:5ad3be8791f39117565557781f5464363b918a45
151 user: test
158 user: test
152 date: Thu Jan 01 00:00:00 1970 +0000
159 date: Thu Jan 01 00:00:00 1970 +0000
153 files: e
160 files: e
154 extra: branch=default
161 extra: branch=default
155 extra: histedit_source=e860deea161a2f77de56603b340ebbb4536308ae
162 extra: histedit_source=e860deea161a2f77de56603b340ebbb4536308ae
156 description:
163 description:
157 foobaz
164 foobaz
158
165
159
166
160
167
161 $ hg histedit tip --commands - 2>&1 <<EOF| fixbundle
168 $ hg histedit tip --commands - 2>&1 <<EOF| fixbundle
162 > edit b5f70786f9b0 f
169 > edit b5f70786f9b0 f
163 > EOF
170 > EOF
164 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
171 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
165 Make changes as needed, you may commit or record as needed now.
172 Make changes as needed, you may commit or record as needed now.
166 When you are finished, run hg histedit --continue to resume.
173 When you are finished, run hg histedit --continue to resume.
167 $ hg status
174 $ hg status
168 A f
175 A f
169
176
170 $ hg summary
177 $ hg summary
171 parent: 5:a5e1ba2f7afb
178 parent: 5:a5e1ba2f7afb
172 foobaz
179 foobaz
173 branch: default
180 branch: default
174 commit: 1 added (new branch head)
181 commit: 1 added (new branch head)
175 update: 1 new changesets (update)
182 update: 1 new changesets (update)
176 hist: 1 remaining (histedit --continue)
183 hist: 1 remaining (histedit --continue)
177
184
178 (test also that editor is invoked if histedit is continued for
185 (test also that editor is invoked if histedit is continued for
179 "edit" action)
186 "edit" action)
180
187
181 $ HGEDITOR='cat' hg histedit --continue
188 $ HGEDITOR='cat' hg histedit --continue
182 f
189 f
183
190
184
191
185 HG: Enter commit message. Lines beginning with 'HG:' are removed.
192 HG: Enter commit message. Lines beginning with 'HG:' are removed.
186 HG: Leave message empty to abort commit.
193 HG: Leave message empty to abort commit.
187 HG: --
194 HG: --
188 HG: user: test
195 HG: user: test
189 HG: branch 'default'
196 HG: branch 'default'
190 HG: added f
197 HG: added f
191 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
198 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 saved backup bundle to $TESTTMP/r/.hg/strip-backup/b5f70786f9b0-c28d9c86-backup.hg (glob)
199 saved backup bundle to $TESTTMP/r/.hg/strip-backup/b5f70786f9b0-c28d9c86-backup.hg (glob)
193
200
194 $ hg status
201 $ hg status
195
202
196 log after edit
203 log after edit
197 $ hg log --limit 1
204 $ hg log --limit 1
198 changeset: 6:a107ee126658
205 changeset: 6:a107ee126658
199 tag: tip
206 tag: tip
200 user: test
207 user: test
201 date: Thu Jan 01 00:00:00 1970 +0000
208 date: Thu Jan 01 00:00:00 1970 +0000
202 summary: f
209 summary: f
203
210
204
211
205 say we'll change the message, but don't.
212 say we'll change the message, but don't.
206 $ cat > ../edit.sh <<EOF
213 $ cat > ../edit.sh <<EOF
207 > cat "\$1" | sed s/pick/mess/ > tmp
214 > cat "\$1" | sed s/pick/mess/ > tmp
208 > mv tmp "\$1"
215 > mv tmp "\$1"
209 > EOF
216 > EOF
210 $ HGEDITOR="sh ../edit.sh" hg histedit tip 2>&1 | fixbundle
217 $ HGEDITOR="sh ../edit.sh" hg histedit tip 2>&1 | fixbundle
211 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
218 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
212 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
219 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
213 $ hg status
220 $ hg status
214 $ hg log --limit 1
221 $ hg log --limit 1
215 changeset: 6:1fd3b2fe7754
222 changeset: 6:1fd3b2fe7754
216 tag: tip
223 tag: tip
217 user: test
224 user: test
218 date: Thu Jan 01 00:00:00 1970 +0000
225 date: Thu Jan 01 00:00:00 1970 +0000
219 summary: f
226 summary: f
220
227
221
228
222 modify the message
229 modify the message
223
230
224 check saving last-message.txt, at first
231 check saving last-message.txt, at first
225
232
226 $ cat > $TESTTMP/commitfailure.py <<EOF
233 $ cat > $TESTTMP/commitfailure.py <<EOF
227 > from mercurial import util
234 > from mercurial import util
228 > def reposetup(ui, repo):
235 > def reposetup(ui, repo):
229 > class commitfailure(repo.__class__):
236 > class commitfailure(repo.__class__):
230 > def commit(self, *args, **kwargs):
237 > def commit(self, *args, **kwargs):
231 > raise util.Abort('emulating unexpected abort')
238 > raise util.Abort('emulating unexpected abort')
232 > repo.__class__ = commitfailure
239 > repo.__class__ = commitfailure
233 > EOF
240 > EOF
234 $ cat >> .hg/hgrc <<EOF
241 $ cat >> .hg/hgrc <<EOF
235 > [extensions]
242 > [extensions]
236 > # this failure occurs before editor invocation
243 > # this failure occurs before editor invocation
237 > commitfailure = $TESTTMP/commitfailure.py
244 > commitfailure = $TESTTMP/commitfailure.py
238 > EOF
245 > EOF
239
246
240 $ cat > $TESTTMP/editor.sh <<EOF
247 $ cat > $TESTTMP/editor.sh <<EOF
241 > echo "==== before editing"
248 > echo "==== before editing"
242 > cat \$1
249 > cat \$1
243 > echo "===="
250 > echo "===="
244 > echo "check saving last-message.txt" >> \$1
251 > echo "check saving last-message.txt" >> \$1
245 > EOF
252 > EOF
246
253
247 (test that editor is not invoked before transaction starting)
254 (test that editor is not invoked before transaction starting)
248
255
249 $ rm -f .hg/last-message.txt
256 $ rm -f .hg/last-message.txt
250 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle
257 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle
251 > mess 1fd3b2fe7754 f
258 > mess 1fd3b2fe7754 f
252 > EOF
259 > EOF
253 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
260 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
254 abort: emulating unexpected abort
261 abort: emulating unexpected abort
255 $ test -f .hg/last-message.txt
262 $ test -f .hg/last-message.txt
256 [1]
263 [1]
257
264
258 $ cat >> .hg/hgrc <<EOF
265 $ cat >> .hg/hgrc <<EOF
259 > [extensions]
266 > [extensions]
260 > commitfailure = !
267 > commitfailure = !
261 > EOF
268 > EOF
262 $ hg histedit --abort -q
269 $ hg histedit --abort -q
263
270
264 (test that editor is invoked and commit message is saved into
271 (test that editor is invoked and commit message is saved into
265 "last-message.txt")
272 "last-message.txt")
266
273
267 $ cat >> .hg/hgrc <<EOF
274 $ cat >> .hg/hgrc <<EOF
268 > [hooks]
275 > [hooks]
269 > # this failure occurs after editor invocation
276 > # this failure occurs after editor invocation
270 > pretxncommit.unexpectedabort = false
277 > pretxncommit.unexpectedabort = false
271 > EOF
278 > EOF
272
279
273 $ hg status --rev '1fd3b2fe7754^1' --rev 1fd3b2fe7754
280 $ hg status --rev '1fd3b2fe7754^1' --rev 1fd3b2fe7754
274 A f
281 A f
275
282
276 $ rm -f .hg/last-message.txt
283 $ rm -f .hg/last-message.txt
277 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF
284 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF
278 > mess 1fd3b2fe7754 f
285 > mess 1fd3b2fe7754 f
279 > EOF
286 > EOF
280 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
287 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
281 adding f
288 adding f
282 ==== before editing
289 ==== before editing
283 f
290 f
284
291
285
292
286 HG: Enter commit message. Lines beginning with 'HG:' are removed.
293 HG: Enter commit message. Lines beginning with 'HG:' are removed.
287 HG: Leave message empty to abort commit.
294 HG: Leave message empty to abort commit.
288 HG: --
295 HG: --
289 HG: user: test
296 HG: user: test
290 HG: branch 'default'
297 HG: branch 'default'
291 HG: added f
298 HG: added f
292 ====
299 ====
293 transaction abort!
300 transaction abort!
294 rollback completed
301 rollback completed
295 note: commit message saved in .hg/last-message.txt
302 note: commit message saved in .hg/last-message.txt
296 abort: pretxncommit.unexpectedabort hook exited with status 1
303 abort: pretxncommit.unexpectedabort hook exited with status 1
297 [255]
304 [255]
298 $ cat .hg/last-message.txt
305 $ cat .hg/last-message.txt
299 f
306 f
300
307
301
308
302 check saving last-message.txt
309 check saving last-message.txt
303
310
304 (test also that editor is invoked if histedit is continued for "message"
311 (test also that editor is invoked if histedit is continued for "message"
305 action)
312 action)
306
313
307 $ HGEDITOR=cat hg histedit --continue
314 $ HGEDITOR=cat hg histedit --continue
308 f
315 f
309
316
310
317
311 HG: Enter commit message. Lines beginning with 'HG:' are removed.
318 HG: Enter commit message. Lines beginning with 'HG:' are removed.
312 HG: Leave message empty to abort commit.
319 HG: Leave message empty to abort commit.
313 HG: --
320 HG: --
314 HG: user: test
321 HG: user: test
315 HG: branch 'default'
322 HG: branch 'default'
316 HG: added f
323 HG: added f
317 transaction abort!
324 transaction abort!
318 rollback completed
325 rollback completed
319 note: commit message saved in .hg/last-message.txt
326 note: commit message saved in .hg/last-message.txt
320 abort: pretxncommit.unexpectedabort hook exited with status 1
327 abort: pretxncommit.unexpectedabort hook exited with status 1
321 [255]
328 [255]
322
329
323 $ cat >> .hg/hgrc <<EOF
330 $ cat >> .hg/hgrc <<EOF
324 > [hooks]
331 > [hooks]
325 > pretxncommit.unexpectedabort =
332 > pretxncommit.unexpectedabort =
326 > EOF
333 > EOF
327 $ hg histedit --abort -q
334 $ hg histedit --abort -q
328
335
329 then, check "modify the message" itself
336 then, check "modify the message" itself
330
337
331 $ hg histedit tip --commands - 2>&1 << EOF | fixbundle
338 $ hg histedit tip --commands - 2>&1 << EOF | fixbundle
332 > mess 1fd3b2fe7754 f
339 > mess 1fd3b2fe7754 f
333 > EOF
340 > EOF
334 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
341 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
335 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
342 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
336 $ hg status
343 $ hg status
337 $ hg log --limit 1
344 $ hg log --limit 1
338 changeset: 6:62feedb1200e
345 changeset: 6:62feedb1200e
339 tag: tip
346 tag: tip
340 user: test
347 user: test
341 date: Thu Jan 01 00:00:00 1970 +0000
348 date: Thu Jan 01 00:00:00 1970 +0000
342 summary: f
349 summary: f
343
350
344
351
345 rollback should not work after a histedit
352 rollback should not work after a histedit
346 $ hg rollback
353 $ hg rollback
347 no rollback information available
354 no rollback information available
348 [1]
355 [1]
349
356
350 $ cd ..
357 $ cd ..
351 $ hg clone -qr0 r r0
358 $ hg clone -qr0 r r0
352 $ cd r0
359 $ cd r0
353 $ hg phase -fdr0
360 $ hg phase -fdr0
354 $ hg histedit --commands - 0 2>&1 << EOF
361 $ hg histedit --commands - 0 2>&1 << EOF
355 > edit cb9a9f314b8b a > $EDITED
362 > edit cb9a9f314b8b a > $EDITED
356 > EOF
363 > EOF
357 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
364 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
358 adding a
365 adding a
359 Make changes as needed, you may commit or record as needed now.
366 Make changes as needed, you may commit or record as needed now.
360 When you are finished, run hg histedit --continue to resume.
367 When you are finished, run hg histedit --continue to resume.
361 [1]
368 [1]
362 $ HGEDITOR=true hg histedit --continue
369 $ HGEDITOR=true hg histedit --continue
363 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
364 saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-cc5ccb0b-backup.hg (glob)
371 saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-cc5ccb0b-backup.hg (glob)
General Comments 0
You need to be logged in to leave comments. Login now