Show More
@@ -1,364 +1,371 | |||
|
1 | 1 | $ . "$TESTDIR/histedit-helpers.sh" |
|
2 | 2 | |
|
3 | 3 | $ cat >> $HGRCPATH <<EOF |
|
4 | 4 | > [extensions] |
|
5 | 5 | > histedit= |
|
6 | 6 | > strip= |
|
7 | 7 | > EOF |
|
8 | 8 | |
|
9 | 9 | $ initrepo () |
|
10 | 10 | > { |
|
11 | 11 | > hg init r |
|
12 | 12 | > cd r |
|
13 | 13 | > for x in a b c d e f g; do |
|
14 | 14 | > echo $x > $x |
|
15 | 15 | > hg add $x |
|
16 | 16 | > hg ci -m $x |
|
17 | 17 | > done |
|
18 | 18 | > } |
|
19 | 19 | |
|
20 | 20 | $ initrepo |
|
21 | 21 | |
|
22 | 22 | log before edit |
|
23 | 23 | $ hg log --graph |
|
24 | 24 | @ changeset: 6:3c6a8ed2ebe8 |
|
25 | 25 | | tag: tip |
|
26 | 26 | | user: test |
|
27 | 27 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
28 | 28 | | summary: g |
|
29 | 29 | | |
|
30 | 30 | o changeset: 5:652413bf663e |
|
31 | 31 | | user: test |
|
32 | 32 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
33 | 33 | | summary: f |
|
34 | 34 | | |
|
35 | 35 | o changeset: 4:e860deea161a |
|
36 | 36 | | user: test |
|
37 | 37 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
38 | 38 | | summary: e |
|
39 | 39 | | |
|
40 | 40 | o changeset: 3:055a42cdd887 |
|
41 | 41 | | user: test |
|
42 | 42 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
43 | 43 | | summary: d |
|
44 | 44 | | |
|
45 | 45 | o changeset: 2:177f92b77385 |
|
46 | 46 | | user: test |
|
47 | 47 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
48 | 48 | | summary: c |
|
49 | 49 | | |
|
50 | 50 | o changeset: 1:d2ae7f538514 |
|
51 | 51 | | user: test |
|
52 | 52 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
53 | 53 | | summary: b |
|
54 | 54 | | |
|
55 | 55 | o changeset: 0:cb9a9f314b8b |
|
56 | 56 | user: test |
|
57 | 57 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
58 | 58 | summary: a |
|
59 | 59 | |
|
60 | 60 | |
|
61 | 61 | edit the history |
|
62 | 62 | $ hg histedit 177f92b77385 --commands - 2>&1 << EOF| fixbundle |
|
63 | 63 | > pick 177f92b77385 c |
|
64 | 64 | > pick 055a42cdd887 d |
|
65 | 65 | > edit e860deea161a e |
|
66 | 66 | > pick 652413bf663e f |
|
67 | 67 | > pick 3c6a8ed2ebe8 g |
|
68 | 68 | > EOF |
|
69 | 69 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
70 | 70 | Make changes as needed, you may commit or record as needed now. |
|
71 | 71 | When you are finished, run hg histedit --continue to resume. |
|
72 | 72 | |
|
73 | 73 | edit the plan |
|
74 | 74 | $ hg histedit --edit-plan --commands - 2>&1 << EOF |
|
75 | 75 | > edit e860deea161a e |
|
76 | 76 | > pick 652413bf663e f |
|
77 | 77 | > drop 3c6a8ed2ebe8 g |
|
78 | 78 | > EOF |
|
79 | 79 | |
|
80 | 80 | Go at a random point and try to continue |
|
81 | 81 | |
|
82 | 82 | $ hg id -n |
|
83 | 83 | 3+ |
|
84 | 84 | $ hg up 0 |
|
85 | 85 | abort: histedit in progress |
|
86 | 86 | (use 'hg histedit --continue' or 'hg histedit --abort') |
|
87 | 87 | [255] |
|
88 | 88 | |
|
89 | 89 | Try to delete necessary commit |
|
90 | 90 | $ hg strip -r 652413bf663e |
|
91 | 91 | abort: histedit in progress, can't strip 363532343133 |
|
92 | 92 | [255] |
|
93 | 93 | |
|
94 | 94 | commit, then edit the revision |
|
95 | 95 | $ hg ci -m 'wat' |
|
96 | 96 | created new head |
|
97 | 97 | $ echo a > e |
|
98 | ||
|
99 | qnew should fail while we're in the middle of the edit step | |
|
100 | ||
|
101 | $ hg --config extensions.mq= qnew please-fail | |
|
102 | abort: histedit in progress | |
|
103 | (use 'hg histedit --continue' or 'hg histedit --abort') | |
|
104 | [255] | |
|
98 | 105 |
$ HGEDITOR='echo |
|
99 | 106 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
100 | 107 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
101 | 108 | |
|
102 | 109 | $ hg log --graph |
|
103 | 110 | @ changeset: 6:b5f70786f9b0 |
|
104 | 111 | | tag: tip |
|
105 | 112 | | user: test |
|
106 | 113 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
107 | 114 | | summary: f |
|
108 | 115 | | |
|
109 | 116 | o changeset: 5:a5e1ba2f7afb |
|
110 | 117 | | user: test |
|
111 | 118 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
112 | 119 | | summary: foobaz |
|
113 | 120 | | |
|
114 | 121 | o changeset: 4:1a60820cd1f6 |
|
115 | 122 | | user: test |
|
116 | 123 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
117 | 124 | | summary: wat |
|
118 | 125 | | |
|
119 | 126 | o changeset: 3:055a42cdd887 |
|
120 | 127 | | user: test |
|
121 | 128 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
122 | 129 | | summary: d |
|
123 | 130 | | |
|
124 | 131 | o changeset: 2:177f92b77385 |
|
125 | 132 | | user: test |
|
126 | 133 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
127 | 134 | | summary: c |
|
128 | 135 | | |
|
129 | 136 | o changeset: 1:d2ae7f538514 |
|
130 | 137 | | user: test |
|
131 | 138 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
132 | 139 | | summary: b |
|
133 | 140 | | |
|
134 | 141 | o changeset: 0:cb9a9f314b8b |
|
135 | 142 | user: test |
|
136 | 143 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
137 | 144 | summary: a |
|
138 | 145 | |
|
139 | 146 | |
|
140 | 147 | $ hg cat e |
|
141 | 148 | a |
|
142 | 149 | |
|
143 | 150 | check histedit_source |
|
144 | 151 | |
|
145 | 152 | $ hg log --debug --rev 5 |
|
146 | 153 | changeset: 5:a5e1ba2f7afb899ef1581cea528fd885d2fca70d |
|
147 | 154 | phase: draft |
|
148 | 155 | parent: 4:1a60820cd1f6004a362aa622ebc47d59bc48eb34 |
|
149 | 156 | parent: -1:0000000000000000000000000000000000000000 |
|
150 | 157 | manifest: 5:5ad3be8791f39117565557781f5464363b918a45 |
|
151 | 158 | user: test |
|
152 | 159 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
153 | 160 | files: e |
|
154 | 161 | extra: branch=default |
|
155 | 162 | extra: histedit_source=e860deea161a2f77de56603b340ebbb4536308ae |
|
156 | 163 | description: |
|
157 | 164 | foobaz |
|
158 | 165 | |
|
159 | 166 | |
|
160 | 167 | |
|
161 | 168 | $ hg histedit tip --commands - 2>&1 <<EOF| fixbundle |
|
162 | 169 |
> edit |
|
163 | 170 | > EOF |
|
164 | 171 |
|
|
165 | 172 |
|
|
166 | 173 |
When |
|
167 | 174 |
$ |
|
168 | 175 |
|
|
169 | 176 | |
|
170 | 177 |
$ |
|
171 | 178 |
parent: |
|
172 | 179 |
|
|
173 | 180 | branch: default |
|
174 | 181 |
commit: |
|
175 | 182 |
update: |
|
176 | 183 |
hist: |
|
177 | 184 | |
|
178 | 185 |
(test |
|
179 | 186 |
"edit" |
|
180 | 187 | |
|
181 | 188 |
|
|
182 | 189 | f |
|
183 | 190 | |
|
184 | 191 | |
|
185 | 192 |
HG: |
|
186 | 193 |
HG: |
|
187 | 194 |
HG: |
|
188 | 195 |
HG: user: |
|
189 | 196 |
HG: |
|
190 | 197 |
HG: |
|
191 | 198 |
|
|
192 | 199 |
|
|
193 | 200 | |
|
194 | 201 |
$ |
|
195 | 202 | |
|
196 | 203 |
|
|
197 | 204 |
$ |
|
198 | 205 |
changeset: |
|
199 | 206 |
tag: |
|
200 | 207 |
user: |
|
201 | 208 |
date: |
|
202 | 209 |
summary: |
|
203 | 210 | |
|
204 | 211 | |
|
205 | 212 |
|
|
206 | 213 |
$ |
|
207 | 214 |
> cat |
|
208 | 215 |
> mv |
|
209 | 216 | > EOF |
|
210 | 217 |
$ |
|
211 | 218 |
|
|
212 | 219 |
|
|
213 | 220 |
$ |
|
214 | 221 |
$ |
|
215 | 222 |
changeset: |
|
216 | 223 |
tag: |
|
217 | 224 |
user: |
|
218 | 225 |
date: |
|
219 | 226 |
summary: |
|
220 | 227 | |
|
221 | 228 | |
|
222 | 229 |
|
|
223 | 230 | |
|
224 | 231 |
|
|
225 | 232 | |
|
226 | 233 |
$ |
|
227 | 234 |
> from |
|
228 | 235 |
> def |
|
229 | 236 |
|
|
230 | 237 | > def commit(self, *args, **kwargs): |
|
231 | 238 | > raise util.Abort('emulating unexpected abort') |
|
232 | 239 | > repo.__class__ = commitfailure |
|
233 | 240 | > EOF |
|
234 | 241 | $ cat >> .hg/hgrc <<EOF |
|
235 | 242 | > [extensions] |
|
236 | 243 | > # this failure occurs before editor invocation |
|
237 | 244 | > commitfailure = $TESTTMP/commitfailure.py |
|
238 | 245 | > EOF |
|
239 | 246 | |
|
240 | 247 | $ cat > $TESTTMP/editor.sh <<EOF |
|
241 | 248 | > echo "==== before editing" |
|
242 | 249 | > cat \$1 |
|
243 | 250 |
> echo |
|
244 | 251 |
> echo |
|
245 | 252 | > EOF |
|
246 | 253 | |
|
247 | 254 | (test that editor is not invoked before transaction starting) |
|
248 | 255 | |
|
249 | 256 | $ rm -f .hg/last-message.txt |
|
250 | 257 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit tip --commands - 2>&1 << EOF | fixbundle |
|
251 | 258 |
> mess |
|
252 | 259 | > EOF |
|
253 | 260 |
|
|
254 | 261 |
abort: |
|
255 | 262 |
$ |
|
256 | 263 | [1] |
|
257 | 264 | |
|
258 | 265 |
$ |
|
259 | 266 | > [extensions] |
|
260 | 267 | > commitfailure = ! |
|
261 | 268 | > EOF |
|
262 | 269 |
$ |
|
263 | 270 | |
|
264 | 271 |
(test |
|
265 | 272 |
|
|
266 | 273 | |
|
267 | 274 |
|
|
268 | 275 | > [hooks] |
|
269 | 276 |
> # this |
|
270 | 277 | > pretxncommit.unexpectedabort = false |
|
271 | 278 | > EOF |
|
272 | 279 | |
|
273 | 280 |
$ |
|
274 | 281 |
|
|
275 | 282 | |
|
276 | 283 |
$ |
|
277 | 284 |
$ |
|
278 | 285 |
> mess |
|
279 | 286 | > EOF |
|
280 | 287 |
|
|
281 | 288 |
|
|
282 | 289 |
==== before |
|
283 | 290 |
|
|
284 | 291 | |
|
285 | 292 | |
|
286 | 293 |
HG: |
|
287 | 294 |
HG: |
|
288 | 295 |
HG: |
|
289 | 296 |
HG: user: |
|
290 | 297 |
HG: |
|
291 | 298 |
HG: |
|
292 | 299 |
=== |
|
293 | 300 |
transaction |
|
294 | 301 |
rollback |
|
295 | 302 |
note: |
|
296 | 303 |
abort: |
|
297 | 304 | [255] |
|
298 | 305 | $ cat .hg/last-message.txt |
|
299 | 306 |
|
|
300 | 307 | |
|
301 | 308 | |
|
302 | 309 |
|
|
303 | 310 | |
|
304 | 311 |
(test |
|
305 | 312 |
|
|
306 | 313 | |
|
307 | 314 |
|
|
308 | 315 | f |
|
309 | 316 | |
|
310 | 317 | |
|
311 | 318 |
HG: |
|
312 | 319 |
HG: |
|
313 | 320 |
HG: |
|
314 | 321 |
HG: user: |
|
315 | 322 |
HG: |
|
316 | 323 |
HG: |
|
317 | 324 |
|
|
318 | 325 |
rollback |
|
319 | 326 |
note: |
|
320 | 327 |
abort: |
|
321 | 328 | [255] |
|
322 | 329 | |
|
323 | 330 | $ cat >> .hg/hgrc <<EOF |
|
324 | 331 | > [hooks] |
|
325 | 332 | > pretxncommit.unexpectedabort = |
|
326 | 333 | > EOF |
|
327 | 334 |
$ hg |
|
328 | 335 | |
|
329 | 336 |
|
|
330 | 337 | |
|
331 | 338 |
$ |
|
332 | 339 |
> mess |
|
333 | 340 | > EOF |
|
334 | 341 |
|
|
335 | 342 |
|
|
336 | 343 |
$ |
|
337 | 344 |
$ |
|
338 | 345 |
changeset: |
|
339 | 346 |
tag: |
|
340 | 347 |
user: |
|
341 | 348 |
date: |
|
342 | 349 |
summary: |
|
343 | 350 | |
|
344 | 351 | |
|
345 | 352 |
|
|
346 | 353 |
$ |
|
347 | 354 |
|
|
348 | 355 | [1] |
|
349 | 356 | |
|
350 | 357 |
$ |
|
351 | 358 |
$ |
|
352 | 359 |
$ |
|
353 | 360 |
$ |
|
354 | 361 |
$ |
|
355 | 362 |
> edit |
|
356 | 363 | > EOF |
|
357 | 364 |
|
|
358 | 365 |
|
|
359 | 366 |
|
|
360 | 367 |
When |
|
361 | 368 | [1] |
|
362 | 369 |
$ |
|
363 | 370 |
|
|
364 | 371 |
|
General Comments 0
You need to be logged in to leave comments.
Login now