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