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