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