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