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