##// END OF EJS Templates
tests: ensure that 'hg update' is disabled during histedit (issue3655)
Jason Gauci -
r28890:46833989 default
parent child Browse files
Show More
@@ -1,476 +1,482 b''
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 dirty a file
60 dirty a file
61 $ echo a > g
61 $ echo a > g
62 $ hg histedit 177f92b77385 --commands - 2>&1 << EOF
62 $ hg histedit 177f92b77385 --commands - 2>&1 << EOF
63 > EOF
63 > EOF
64 abort: uncommitted changes
64 abort: uncommitted changes
65 [255]
65 [255]
66 $ echo g > g
66 $ echo g > g
67
67
68 edit the history
68 edit the history
69 $ hg histedit 177f92b77385 --commands - 2>&1 << EOF| fixbundle
69 $ hg histedit 177f92b77385 --commands - 2>&1 << EOF| fixbundle
70 > pick 177f92b77385 c
70 > pick 177f92b77385 c
71 > pick 055a42cdd887 d
71 > pick 055a42cdd887 d
72 > edit e860deea161a e
72 > edit e860deea161a e
73 > pick 652413bf663e f
73 > pick 652413bf663e f
74 > pick 3c6a8ed2ebe8 g
74 > pick 3c6a8ed2ebe8 g
75 > EOF
75 > EOF
76 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
76 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
77 Editing (e860deea161a), you may commit or record as needed now.
77 Editing (e860deea161a), you may commit or record as needed now.
78 (hg histedit --continue to resume)
78 (hg histedit --continue to resume)
79
79
80 try to update and get an error
81 $ hg update tip
82 abort: histedit in progress
83 (use 'hg histedit --continue' or 'hg histedit --abort')
84 [255]
85
80 edit the plan via the editor
86 edit the plan via the editor
81 $ cat >> $TESTTMP/editplan.sh <<EOF
87 $ cat >> $TESTTMP/editplan.sh <<EOF
82 > cat > \$1 <<EOF2
88 > cat > \$1 <<EOF2
83 > drop e860deea161a e
89 > drop e860deea161a e
84 > drop 652413bf663e f
90 > drop 652413bf663e f
85 > drop 3c6a8ed2ebe8 g
91 > drop 3c6a8ed2ebe8 g
86 > EOF2
92 > EOF2
87 > EOF
93 > EOF
88 $ HGEDITOR="sh $TESTTMP/editplan.sh" hg histedit --edit-plan
94 $ HGEDITOR="sh $TESTTMP/editplan.sh" hg histedit --edit-plan
89 $ cat .hg/histedit-state
95 $ cat .hg/histedit-state
90 v1
96 v1
91 055a42cdd88768532f9cf79daa407fc8d138de9b
97 055a42cdd88768532f9cf79daa407fc8d138de9b
92 3c6a8ed2ebe862cc949d2caa30775dd6f16fb799
98 3c6a8ed2ebe862cc949d2caa30775dd6f16fb799
93 False
99 False
94 3
100 3
95 drop
101 drop
96 e860deea161a2f77de56603b340ebbb4536308ae
102 e860deea161a2f77de56603b340ebbb4536308ae
97 drop
103 drop
98 652413bf663ef2a641cab26574e46d5f5a64a55a
104 652413bf663ef2a641cab26574e46d5f5a64a55a
99 drop
105 drop
100 3c6a8ed2ebe862cc949d2caa30775dd6f16fb799
106 3c6a8ed2ebe862cc949d2caa30775dd6f16fb799
101 0
107 0
102 strip-backup/177f92b77385-0ebe6a8f-histedit.hg
108 strip-backup/177f92b77385-0ebe6a8f-histedit.hg
103
109
104 edit the plan via --commands
110 edit the plan via --commands
105 $ hg histedit --edit-plan --commands - 2>&1 << EOF
111 $ hg histedit --edit-plan --commands - 2>&1 << EOF
106 > edit e860deea161a e
112 > edit e860deea161a e
107 > pick 652413bf663e f
113 > pick 652413bf663e f
108 > drop 3c6a8ed2ebe8 g
114 > drop 3c6a8ed2ebe8 g
109 > EOF
115 > EOF
110 $ cat .hg/histedit-state
116 $ cat .hg/histedit-state
111 v1
117 v1
112 055a42cdd88768532f9cf79daa407fc8d138de9b
118 055a42cdd88768532f9cf79daa407fc8d138de9b
113 3c6a8ed2ebe862cc949d2caa30775dd6f16fb799
119 3c6a8ed2ebe862cc949d2caa30775dd6f16fb799
114 False
120 False
115 3
121 3
116 edit
122 edit
117 e860deea161a2f77de56603b340ebbb4536308ae
123 e860deea161a2f77de56603b340ebbb4536308ae
118 pick
124 pick
119 652413bf663ef2a641cab26574e46d5f5a64a55a
125 652413bf663ef2a641cab26574e46d5f5a64a55a
120 drop
126 drop
121 3c6a8ed2ebe862cc949d2caa30775dd6f16fb799
127 3c6a8ed2ebe862cc949d2caa30775dd6f16fb799
122 0
128 0
123 strip-backup/177f92b77385-0ebe6a8f-histedit.hg
129 strip-backup/177f92b77385-0ebe6a8f-histedit.hg
124
130
125 Go at a random point and try to continue
131 Go at a random point and try to continue
126
132
127 $ hg id -n
133 $ hg id -n
128 3+
134 3+
129 $ hg up 0
135 $ hg up 0
130 abort: histedit in progress
136 abort: histedit in progress
131 (use 'hg histedit --continue' or 'hg histedit --abort')
137 (use 'hg histedit --continue' or 'hg histedit --abort')
132 [255]
138 [255]
133
139
134 Try to delete necessary commit
140 Try to delete necessary commit
135 $ hg strip -r 652413b
141 $ hg strip -r 652413b
136 abort: histedit in progress, can't strip 652413bf663e
142 abort: histedit in progress, can't strip 652413bf663e
137 [255]
143 [255]
138
144
139 commit, then edit the revision
145 commit, then edit the revision
140 $ hg ci -m 'wat'
146 $ hg ci -m 'wat'
141 created new head
147 created new head
142 $ echo a > e
148 $ echo a > e
143
149
144 qnew should fail while we're in the middle of the edit step
150 qnew should fail while we're in the middle of the edit step
145
151
146 $ hg --config extensions.mq= qnew please-fail
152 $ hg --config extensions.mq= qnew please-fail
147 abort: histedit in progress
153 abort: histedit in progress
148 (use 'hg histedit --continue' or 'hg histedit --abort')
154 (use 'hg histedit --continue' or 'hg histedit --abort')
149 [255]
155 [255]
150 $ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle
156 $ HGEDITOR='echo foobaz > ' hg histedit --continue 2>&1 | fixbundle
151
157
152 $ hg log --graph
158 $ hg log --graph
153 @ changeset: 6:b5f70786f9b0
159 @ changeset: 6:b5f70786f9b0
154 | tag: tip
160 | tag: tip
155 | user: test
161 | user: test
156 | date: Thu Jan 01 00:00:00 1970 +0000
162 | date: Thu Jan 01 00:00:00 1970 +0000
157 | summary: f
163 | summary: f
158 |
164 |
159 o changeset: 5:a5e1ba2f7afb
165 o changeset: 5:a5e1ba2f7afb
160 | user: test
166 | user: test
161 | date: Thu Jan 01 00:00:00 1970 +0000
167 | date: Thu Jan 01 00:00:00 1970 +0000
162 | summary: foobaz
168 | summary: foobaz
163 |
169 |
164 o changeset: 4:1a60820cd1f6
170 o changeset: 4:1a60820cd1f6
165 | user: test
171 | user: test
166 | date: Thu Jan 01 00:00:00 1970 +0000
172 | date: Thu Jan 01 00:00:00 1970 +0000
167 | summary: wat
173 | summary: wat
168 |
174 |
169 o changeset: 3:055a42cdd887
175 o changeset: 3:055a42cdd887
170 | user: test
176 | user: test
171 | date: Thu Jan 01 00:00:00 1970 +0000
177 | date: Thu Jan 01 00:00:00 1970 +0000
172 | summary: d
178 | summary: d
173 |
179 |
174 o changeset: 2:177f92b77385
180 o changeset: 2:177f92b77385
175 | user: test
181 | user: test
176 | date: Thu Jan 01 00:00:00 1970 +0000
182 | date: Thu Jan 01 00:00:00 1970 +0000
177 | summary: c
183 | summary: c
178 |
184 |
179 o changeset: 1:d2ae7f538514
185 o changeset: 1:d2ae7f538514
180 | user: test
186 | user: test
181 | date: Thu Jan 01 00:00:00 1970 +0000
187 | date: Thu Jan 01 00:00:00 1970 +0000
182 | summary: b
188 | summary: b
183 |
189 |
184 o changeset: 0:cb9a9f314b8b
190 o changeset: 0:cb9a9f314b8b
185 user: test
191 user: test
186 date: Thu Jan 01 00:00:00 1970 +0000
192 date: Thu Jan 01 00:00:00 1970 +0000
187 summary: a
193 summary: a
188
194
189
195
190 $ hg cat e
196 $ hg cat e
191 a
197 a
192
198
193 Stripping necessary commits should not break --abort
199 Stripping necessary commits should not break --abort
194
200
195 $ hg histedit 1a60820cd1f6 --commands - 2>&1 << EOF| fixbundle
201 $ hg histedit 1a60820cd1f6 --commands - 2>&1 << EOF| fixbundle
196 > edit 1a60820cd1f6 wat
202 > edit 1a60820cd1f6 wat
197 > pick a5e1ba2f7afb foobaz
203 > pick a5e1ba2f7afb foobaz
198 > pick b5f70786f9b0 g
204 > pick b5f70786f9b0 g
199 > EOF
205 > EOF
200 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
206 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
201 Editing (1a60820cd1f6), you may commit or record as needed now.
207 Editing (1a60820cd1f6), you may commit or record as needed now.
202 (hg histedit --continue to resume)
208 (hg histedit --continue to resume)
203
209
204 $ mv .hg/histedit-state .hg/histedit-state.bak
210 $ mv .hg/histedit-state .hg/histedit-state.bak
205 $ hg strip -q -r b5f70786f9b0
211 $ hg strip -q -r b5f70786f9b0
206 $ mv .hg/histedit-state.bak .hg/histedit-state
212 $ mv .hg/histedit-state.bak .hg/histedit-state
207 $ hg histedit --abort
213 $ hg histedit --abort
208 adding changesets
214 adding changesets
209 adding manifests
215 adding manifests
210 adding file changes
216 adding file changes
211 added 1 changesets with 1 changes to 3 files
217 added 1 changesets with 1 changes to 3 files
212 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
218 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
213 $ hg log -r .
219 $ hg log -r .
214 changeset: 6:b5f70786f9b0
220 changeset: 6:b5f70786f9b0
215 tag: tip
221 tag: tip
216 user: test
222 user: test
217 date: Thu Jan 01 00:00:00 1970 +0000
223 date: Thu Jan 01 00:00:00 1970 +0000
218 summary: f
224 summary: f
219
225
220
226
221 check histedit_source
227 check histedit_source
222
228
223 $ hg log --debug --rev 5
229 $ hg log --debug --rev 5
224 changeset: 5:a5e1ba2f7afb899ef1581cea528fd885d2fca70d
230 changeset: 5:a5e1ba2f7afb899ef1581cea528fd885d2fca70d
225 phase: draft
231 phase: draft
226 parent: 4:1a60820cd1f6004a362aa622ebc47d59bc48eb34
232 parent: 4:1a60820cd1f6004a362aa622ebc47d59bc48eb34
227 parent: -1:0000000000000000000000000000000000000000
233 parent: -1:0000000000000000000000000000000000000000
228 manifest: 5:5ad3be8791f39117565557781f5464363b918a45
234 manifest: 5:5ad3be8791f39117565557781f5464363b918a45
229 user: test
235 user: test
230 date: Thu Jan 01 00:00:00 1970 +0000
236 date: Thu Jan 01 00:00:00 1970 +0000
231 files: e
237 files: e
232 extra: branch=default
238 extra: branch=default
233 extra: histedit_source=e860deea161a2f77de56603b340ebbb4536308ae
239 extra: histedit_source=e860deea161a2f77de56603b340ebbb4536308ae
234 description:
240 description:
235 foobaz
241 foobaz
236
242
237
243
238
244
239 $ hg histedit tip --commands - 2>&1 <<EOF| fixbundle
245 $ hg histedit tip --commands - 2>&1 <<EOF| fixbundle
240 > edit b5f70786f9b0 f
246 > edit b5f70786f9b0 f
241 > EOF
247 > EOF
242 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
248 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
243 Editing (b5f70786f9b0), you may commit or record as needed now.
249 Editing (b5f70786f9b0), you may commit or record as needed now.
244 (hg histedit --continue to resume)
250 (hg histedit --continue to resume)
245 $ hg status
251 $ hg status
246 A f
252 A f
247
253
248 $ hg summary
254 $ hg summary
249 parent: 5:a5e1ba2f7afb
255 parent: 5:a5e1ba2f7afb
250 foobaz
256 foobaz
251 branch: default
257 branch: default
252 commit: 1 added (new branch head)
258 commit: 1 added (new branch head)
253 update: 1 new changesets (update)
259 update: 1 new changesets (update)
254 phases: 7 draft
260 phases: 7 draft
255 hist: 1 remaining (histedit --continue)
261 hist: 1 remaining (histedit --continue)
256
262
257 (test also that editor is invoked if histedit is continued for
263 (test also that editor is invoked if histedit is continued for
258 "edit" action)
264 "edit" action)
259
265
260 $ HGEDITOR='cat' hg histedit --continue
266 $ HGEDITOR='cat' hg histedit --continue
261 f
267 f
262
268
263
269
264 HG: Enter commit message. Lines beginning with 'HG:' are removed.
270 HG: Enter commit message. Lines beginning with 'HG:' are removed.
265 HG: Leave message empty to abort commit.
271 HG: Leave message empty to abort commit.
266 HG: --
272 HG: --
267 HG: user: test
273 HG: user: test
268 HG: branch 'default'
274 HG: branch 'default'
269 HG: added f
275 HG: added f
270 saved backup bundle to $TESTTMP/r/.hg/strip-backup/b5f70786f9b0-c28d9c86-backup.hg (glob)
276 saved backup bundle to $TESTTMP/r/.hg/strip-backup/b5f70786f9b0-c28d9c86-backup.hg (glob)
271
277
272 $ hg status
278 $ hg status
273
279
274 log after edit
280 log after edit
275 $ hg log --limit 1
281 $ hg log --limit 1
276 changeset: 6:a107ee126658
282 changeset: 6:a107ee126658
277 tag: tip
283 tag: tip
278 user: test
284 user: test
279 date: Thu Jan 01 00:00:00 1970 +0000
285 date: Thu Jan 01 00:00:00 1970 +0000
280 summary: f
286 summary: f
281
287
282
288
283 say we'll change the message, but don't.
289 say we'll change the message, but don't.
284 $ cat > ../edit.sh <<EOF
290 $ cat > ../edit.sh <<EOF
285 > cat "\$1" | sed s/pick/mess/ > tmp
291 > cat "\$1" | sed s/pick/mess/ > tmp
286 > mv tmp "\$1"
292 > mv tmp "\$1"
287 > EOF
293 > EOF
288 $ HGEDITOR="sh ../edit.sh" hg histedit tip 2>&1 | fixbundle
294 $ HGEDITOR="sh ../edit.sh" hg histedit tip 2>&1 | fixbundle
289 $ hg status
295 $ hg status
290 $ hg log --limit 1
296 $ hg log --limit 1
291 changeset: 6:1fd3b2fe7754
297 changeset: 6:1fd3b2fe7754
292 tag: tip
298 tag: tip
293 user: test
299 user: test
294 date: Thu Jan 01 00:00:00 1970 +0000
300 date: Thu Jan 01 00:00:00 1970 +0000
295 summary: f
301 summary: f
296
302
297
303
298 modify the message
304 modify the message
299
305
300 check saving last-message.txt, at first
306 check saving last-message.txt, at first
301
307
302 $ cat > $TESTTMP/commitfailure.py <<EOF
308 $ cat > $TESTTMP/commitfailure.py <<EOF
303 > from mercurial import error
309 > from mercurial import error
304 > def reposetup(ui, repo):
310 > def reposetup(ui, repo):
305 > class commitfailure(repo.__class__):
311 > class commitfailure(repo.__class__):
306 > def commit(self, *args, **kwargs):
312 > def commit(self, *args, **kwargs):
307 > raise error.Abort('emulating unexpected abort')
313 > raise error.Abort('emulating unexpected abort')
308 > repo.__class__ = commitfailure
314 > repo.__class__ = commitfailure
309 > EOF
315 > EOF
310 $ cat >> .hg/hgrc <<EOF
316 $ cat >> .hg/hgrc <<EOF
311 > [extensions]
317 > [extensions]
312 > # this failure occurs before editor invocation
318 > # this failure occurs before editor invocation
313 > commitfailure = $TESTTMP/commitfailure.py
319 > commitfailure = $TESTTMP/commitfailure.py
314 > EOF
320 > EOF
315
321
316 $ cat > $TESTTMP/editor.sh <<EOF
322 $ cat > $TESTTMP/editor.sh <<EOF
317 > echo "==== before editing"
323 > echo "==== before editing"
318 > cat \$1
324 > cat \$1
319 > echo "===="
325 > echo "===="
320 > echo "check saving last-message.txt" >> \$1
326 > echo "check saving last-message.txt" >> \$1
321 > EOF
327 > EOF
322
328
323 (test that editor is not invoked before transaction starting)
329 (test that editor is not invoked before transaction starting)
324
330
325 $ rm -f .hg/last-message.txt
331 $ rm -f .hg/last-message.txt
326 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle
332 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle
327 > mess 1fd3b2fe7754 f
333 > mess 1fd3b2fe7754 f
328 > EOF
334 > EOF
329 abort: emulating unexpected abort
335 abort: emulating unexpected abort
330 $ test -f .hg/last-message.txt
336 $ test -f .hg/last-message.txt
331 [1]
337 [1]
332
338
333 $ cat >> .hg/hgrc <<EOF
339 $ cat >> .hg/hgrc <<EOF
334 > [extensions]
340 > [extensions]
335 > commitfailure = !
341 > commitfailure = !
336 > EOF
342 > EOF
337 $ hg histedit --abort -q
343 $ hg histedit --abort -q
338
344
339 (test that editor is invoked and commit message is saved into
345 (test that editor is invoked and commit message is saved into
340 "last-message.txt")
346 "last-message.txt")
341
347
342 $ cat >> .hg/hgrc <<EOF
348 $ cat >> .hg/hgrc <<EOF
343 > [hooks]
349 > [hooks]
344 > # this failure occurs after editor invocation
350 > # this failure occurs after editor invocation
345 > pretxncommit.unexpectedabort = false
351 > pretxncommit.unexpectedabort = false
346 > EOF
352 > EOF
347
353
348 $ hg status --rev '1fd3b2fe7754^1' --rev 1fd3b2fe7754
354 $ hg status --rev '1fd3b2fe7754^1' --rev 1fd3b2fe7754
349 A f
355 A f
350
356
351 $ rm -f .hg/last-message.txt
357 $ rm -f .hg/last-message.txt
352 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF
358 $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF
353 > mess 1fd3b2fe7754 f
359 > mess 1fd3b2fe7754 f
354 > EOF
360 > EOF
355 ==== before editing
361 ==== before editing
356 f
362 f
357
363
358
364
359 HG: Enter commit message. Lines beginning with 'HG:' are removed.
365 HG: Enter commit message. Lines beginning with 'HG:' are removed.
360 HG: Leave message empty to abort commit.
366 HG: Leave message empty to abort commit.
361 HG: --
367 HG: --
362 HG: user: test
368 HG: user: test
363 HG: branch 'default'
369 HG: branch 'default'
364 HG: added f
370 HG: added f
365 ====
371 ====
366 note: commit message saved in .hg/last-message.txt
372 note: commit message saved in .hg/last-message.txt
367 transaction abort!
373 transaction abort!
368 rollback completed
374 rollback completed
369 abort: pretxncommit.unexpectedabort hook exited with status 1
375 abort: pretxncommit.unexpectedabort hook exited with status 1
370 [255]
376 [255]
371 $ cat .hg/last-message.txt
377 $ cat .hg/last-message.txt
372 f
378 f
373
379
374
380
375 check saving last-message.txt
381 check saving last-message.txt
376
382
377 (test also that editor is invoked if histedit is continued for "message"
383 (test also that editor is invoked if histedit is continued for "message"
378 action)
384 action)
379
385
380 $ HGEDITOR=cat hg histedit --continue
386 $ HGEDITOR=cat hg histedit --continue
381 f
387 f
382
388
383
389
384 HG: Enter commit message. Lines beginning with 'HG:' are removed.
390 HG: Enter commit message. Lines beginning with 'HG:' are removed.
385 HG: Leave message empty to abort commit.
391 HG: Leave message empty to abort commit.
386 HG: --
392 HG: --
387 HG: user: test
393 HG: user: test
388 HG: branch 'default'
394 HG: branch 'default'
389 HG: added f
395 HG: added f
390 note: commit message saved in .hg/last-message.txt
396 note: commit message saved in .hg/last-message.txt
391 transaction abort!
397 transaction abort!
392 rollback completed
398 rollback completed
393 abort: pretxncommit.unexpectedabort hook exited with status 1
399 abort: pretxncommit.unexpectedabort hook exited with status 1
394 [255]
400 [255]
395
401
396 $ cat >> .hg/hgrc <<EOF
402 $ cat >> .hg/hgrc <<EOF
397 > [hooks]
403 > [hooks]
398 > pretxncommit.unexpectedabort =
404 > pretxncommit.unexpectedabort =
399 > EOF
405 > EOF
400 $ hg histedit --abort -q
406 $ hg histedit --abort -q
401
407
402 then, check "modify the message" itself
408 then, check "modify the message" itself
403
409
404 $ hg histedit tip --commands - 2>&1 << EOF | fixbundle
410 $ hg histedit tip --commands - 2>&1 << EOF | fixbundle
405 > mess 1fd3b2fe7754 f
411 > mess 1fd3b2fe7754 f
406 > EOF
412 > EOF
407 $ hg status
413 $ hg status
408 $ hg log --limit 1
414 $ hg log --limit 1
409 changeset: 6:62feedb1200e
415 changeset: 6:62feedb1200e
410 tag: tip
416 tag: tip
411 user: test
417 user: test
412 date: Thu Jan 01 00:00:00 1970 +0000
418 date: Thu Jan 01 00:00:00 1970 +0000
413 summary: f
419 summary: f
414
420
415
421
416 rollback should not work after a histedit
422 rollback should not work after a histedit
417 $ hg rollback
423 $ hg rollback
418 no rollback information available
424 no rollback information available
419 [1]
425 [1]
420
426
421 $ cd ..
427 $ cd ..
422 $ hg clone -qr0 r r0
428 $ hg clone -qr0 r r0
423 $ cd r0
429 $ cd r0
424 $ hg phase -fdr0
430 $ hg phase -fdr0
425 $ hg histedit --commands - 0 2>&1 << EOF
431 $ hg histedit --commands - 0 2>&1 << EOF
426 > edit cb9a9f314b8b a > $EDITED
432 > edit cb9a9f314b8b a > $EDITED
427 > EOF
433 > EOF
428 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
434 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
429 adding a
435 adding a
430 Editing (cb9a9f314b8b), you may commit or record as needed now.
436 Editing (cb9a9f314b8b), you may commit or record as needed now.
431 (hg histedit --continue to resume)
437 (hg histedit --continue to resume)
432 [1]
438 [1]
433 $ HGEDITOR=true hg histedit --continue
439 $ HGEDITOR=true hg histedit --continue
434 saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-cc5ccb0b-backup.hg (glob)
440 saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-cc5ccb0b-backup.hg (glob)
435
441
436 $ hg log -G
442 $ hg log -G
437 @ changeset: 0:0efcea34f18a
443 @ changeset: 0:0efcea34f18a
438 tag: tip
444 tag: tip
439 user: test
445 user: test
440 date: Thu Jan 01 00:00:00 1970 +0000
446 date: Thu Jan 01 00:00:00 1970 +0000
441 summary: a
447 summary: a
442
448
443 $ echo foo >> b
449 $ echo foo >> b
444 $ hg addr
450 $ hg addr
445 adding b
451 adding b
446 $ hg ci -m 'add b'
452 $ hg ci -m 'add b'
447 $ echo foo >> a
453 $ echo foo >> a
448 $ hg ci -m 'extend a'
454 $ hg ci -m 'extend a'
449 $ hg phase --public 1
455 $ hg phase --public 1
450 Attempting to fold a change into a public change should not work:
456 Attempting to fold a change into a public change should not work:
451 $ cat > ../edit.sh <<EOF
457 $ cat > ../edit.sh <<EOF
452 > cat "\$1" | sed s/pick/fold/ > tmp
458 > cat "\$1" | sed s/pick/fold/ > tmp
453 > mv tmp "\$1"
459 > mv tmp "\$1"
454 > EOF
460 > EOF
455 $ HGEDITOR="sh ../edit.sh" hg histedit 2
461 $ HGEDITOR="sh ../edit.sh" hg histedit 2
456 warning: histedit rules saved to: .hg/histedit-last-edit.txt
462 warning: histedit rules saved to: .hg/histedit-last-edit.txt
457 hg: parse error: cannot fold into public change 18aa70c8ad22
463 hg: parse error: cannot fold into public change 18aa70c8ad22
458 [255]
464 [255]
459 $ cat .hg/histedit-last-edit.txt
465 $ cat .hg/histedit-last-edit.txt
460 fold 0012be4a27ea 2 extend a
466 fold 0012be4a27ea 2 extend a
461
467
462 # Edit history between 0012be4a27ea and 0012be4a27ea
468 # Edit history between 0012be4a27ea and 0012be4a27ea
463 #
469 #
464 # Commits are listed from least to most recent
470 # Commits are listed from least to most recent
465 #
471 #
466 # You can reorder changesets by reordering the lines
472 # You can reorder changesets by reordering the lines
467 #
473 #
468 # Commands:
474 # Commands:
469 #
475 #
470 # e, edit = use commit, but stop for amending
476 # e, edit = use commit, but stop for amending
471 # m, mess = edit commit message without changing commit content
477 # m, mess = edit commit message without changing commit content
472 # p, fold = use commit
478 # p, fold = use commit
473 # d, drop = remove commit from history
479 # d, drop = remove commit from history
474 # f, fold = use commit, but combine it with the one above
480 # f, fold = use commit, but combine it with the one above
475 # r, roll = like fold, but discard this commit's description
481 # r, roll = like fold, but discard this commit's description
476 #
482 #
General Comments 0
You need to be logged in to leave comments. Login now