##// END OF EJS Templates
rebase: also test abort from pretxnclose error...
marmoute -
r33139:22ab4664 stable
parent child Browse files
Show More
@@ -1,381 +1,431 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 >
4 >
5 > [phases]
5 > [phases]
6 > publish=False
6 > publish=False
7 >
7 >
8 > [alias]
8 > [alias]
9 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
9 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
10 > tglogp = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
10 > tglogp = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
11 > EOF
11 > EOF
12
12
13
13
14 $ hg init a
14 $ hg init a
15 $ cd a
15 $ cd a
16
16
17 $ echo A > A
17 $ echo A > A
18 $ hg ci -Am A
18 $ hg ci -Am A
19 adding A
19 adding A
20
20
21 $ echo B > B
21 $ echo B > B
22 $ hg ci -Am B
22 $ hg ci -Am B
23 adding B
23 adding B
24
24
25 $ echo C >> A
25 $ echo C >> A
26 $ hg ci -m C
26 $ hg ci -m C
27
27
28 $ hg up -q -C 0
28 $ hg up -q -C 0
29
29
30 $ echo D >> A
30 $ echo D >> A
31 $ hg ci -m D
31 $ hg ci -m D
32 created new head
32 created new head
33
33
34 $ echo E > E
34 $ echo E > E
35 $ hg ci -Am E
35 $ hg ci -Am E
36 adding E
36 adding E
37
37
38 $ cd ..
38 $ cd ..
39
39
40
40
41 Changes during an interruption - continue:
41 Changes during an interruption - continue:
42
42
43 $ hg clone -q -u . a a1
43 $ hg clone -q -u . a a1
44 $ cd a1
44 $ cd a1
45
45
46 $ hg tglog
46 $ hg tglog
47 @ 4: 'E'
47 @ 4: 'E'
48 |
48 |
49 o 3: 'D'
49 o 3: 'D'
50 |
50 |
51 | o 2: 'C'
51 | o 2: 'C'
52 | |
52 | |
53 | o 1: 'B'
53 | o 1: 'B'
54 |/
54 |/
55 o 0: 'A'
55 o 0: 'A'
56
56
57 Rebasing B onto E:
57 Rebasing B onto E:
58
58
59 $ hg rebase -s 1 -d 4
59 $ hg rebase -s 1 -d 4
60 rebasing 1:27547f69f254 "B"
60 rebasing 1:27547f69f254 "B"
61 rebasing 2:965c486023db "C"
61 rebasing 2:965c486023db "C"
62 merging A
62 merging A
63 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
63 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
64 unresolved conflicts (see hg resolve, then hg rebase --continue)
64 unresolved conflicts (see hg resolve, then hg rebase --continue)
65 [1]
65 [1]
66
66
67 Force a commit on C during the interruption:
67 Force a commit on C during the interruption:
68
68
69 $ hg up -q -C 2 --config 'extensions.rebase=!'
69 $ hg up -q -C 2 --config 'extensions.rebase=!'
70
70
71 $ echo 'Extra' > Extra
71 $ echo 'Extra' > Extra
72 $ hg add Extra
72 $ hg add Extra
73 $ hg ci -m 'Extra' --config 'extensions.rebase=!'
73 $ hg ci -m 'Extra' --config 'extensions.rebase=!'
74
74
75 Force this commit onto secret phase
75 Force this commit onto secret phase
76
76
77 $ hg phase --force --secret 6
77 $ hg phase --force --secret 6
78
78
79 $ hg tglogp
79 $ hg tglogp
80 @ 6:secret 'Extra'
80 @ 6:secret 'Extra'
81 |
81 |
82 | o 5:draft 'B'
82 | o 5:draft 'B'
83 | |
83 | |
84 | o 4:draft 'E'
84 | o 4:draft 'E'
85 | |
85 | |
86 | o 3:draft 'D'
86 | o 3:draft 'D'
87 | |
87 | |
88 o | 2:draft 'C'
88 o | 2:draft 'C'
89 | |
89 | |
90 o | 1:draft 'B'
90 o | 1:draft 'B'
91 |/
91 |/
92 o 0:draft 'A'
92 o 0:draft 'A'
93
93
94 Resume the rebasing:
94 Resume the rebasing:
95
95
96 $ hg rebase --continue
96 $ hg rebase --continue
97 already rebased 1:27547f69f254 "B" as 45396c49d53b
97 already rebased 1:27547f69f254 "B" as 45396c49d53b
98 rebasing 2:965c486023db "C"
98 rebasing 2:965c486023db "C"
99 merging A
99 merging A
100 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
100 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
101 unresolved conflicts (see hg resolve, then hg rebase --continue)
101 unresolved conflicts (see hg resolve, then hg rebase --continue)
102 [1]
102 [1]
103
103
104 Solve the conflict and go on:
104 Solve the conflict and go on:
105
105
106 $ echo 'conflict solved' > A
106 $ echo 'conflict solved' > A
107 $ rm A.orig
107 $ rm A.orig
108 $ hg resolve -m A
108 $ hg resolve -m A
109 (no more unresolved files)
109 (no more unresolved files)
110 continue: hg rebase --continue
110 continue: hg rebase --continue
111
111
112 $ hg rebase --continue
112 $ hg rebase --continue
113 already rebased 1:27547f69f254 "B" as 45396c49d53b
113 already rebased 1:27547f69f254 "B" as 45396c49d53b
114 rebasing 2:965c486023db "C"
114 rebasing 2:965c486023db "C"
115 warning: new changesets detected on source branch, not stripping
115 warning: new changesets detected on source branch, not stripping
116
116
117 $ hg tglogp
117 $ hg tglogp
118 o 7:draft 'C'
118 o 7:draft 'C'
119 |
119 |
120 | o 6:secret 'Extra'
120 | o 6:secret 'Extra'
121 | |
121 | |
122 o | 5:draft 'B'
122 o | 5:draft 'B'
123 | |
123 | |
124 @ | 4:draft 'E'
124 @ | 4:draft 'E'
125 | |
125 | |
126 o | 3:draft 'D'
126 o | 3:draft 'D'
127 | |
127 | |
128 | o 2:draft 'C'
128 | o 2:draft 'C'
129 | |
129 | |
130 | o 1:draft 'B'
130 | o 1:draft 'B'
131 |/
131 |/
132 o 0:draft 'A'
132 o 0:draft 'A'
133
133
134 $ cd ..
134 $ cd ..
135
135
136
136
137 Changes during an interruption - abort:
137 Changes during an interruption - abort:
138
138
139 $ hg clone -q -u . a a2
139 $ hg clone -q -u . a a2
140 $ cd a2
140 $ cd a2
141
141
142 $ hg tglog
142 $ hg tglog
143 @ 4: 'E'
143 @ 4: 'E'
144 |
144 |
145 o 3: 'D'
145 o 3: 'D'
146 |
146 |
147 | o 2: 'C'
147 | o 2: 'C'
148 | |
148 | |
149 | o 1: 'B'
149 | o 1: 'B'
150 |/
150 |/
151 o 0: 'A'
151 o 0: 'A'
152
152
153 Rebasing B onto E:
153 Rebasing B onto E:
154
154
155 $ hg rebase -s 1 -d 4
155 $ hg rebase -s 1 -d 4
156 rebasing 1:27547f69f254 "B"
156 rebasing 1:27547f69f254 "B"
157 rebasing 2:965c486023db "C"
157 rebasing 2:965c486023db "C"
158 merging A
158 merging A
159 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
159 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
160 unresolved conflicts (see hg resolve, then hg rebase --continue)
160 unresolved conflicts (see hg resolve, then hg rebase --continue)
161 [1]
161 [1]
162
162
163 Force a commit on B' during the interruption:
163 Force a commit on B' during the interruption:
164
164
165 $ hg up -q -C 5 --config 'extensions.rebase=!'
165 $ hg up -q -C 5 --config 'extensions.rebase=!'
166
166
167 $ echo 'Extra' > Extra
167 $ echo 'Extra' > Extra
168 $ hg add Extra
168 $ hg add Extra
169 $ hg ci -m 'Extra' --config 'extensions.rebase=!'
169 $ hg ci -m 'Extra' --config 'extensions.rebase=!'
170
170
171 $ hg tglog
171 $ hg tglog
172 @ 6: 'Extra'
172 @ 6: 'Extra'
173 |
173 |
174 o 5: 'B'
174 o 5: 'B'
175 |
175 |
176 o 4: 'E'
176 o 4: 'E'
177 |
177 |
178 o 3: 'D'
178 o 3: 'D'
179 |
179 |
180 | o 2: 'C'
180 | o 2: 'C'
181 | |
181 | |
182 | o 1: 'B'
182 | o 1: 'B'
183 |/
183 |/
184 o 0: 'A'
184 o 0: 'A'
185
185
186 Abort the rebasing:
186 Abort the rebasing:
187
187
188 $ hg rebase --abort
188 $ hg rebase --abort
189 warning: new changesets detected on target branch, can't strip
189 warning: new changesets detected on target branch, can't strip
190 rebase aborted
190 rebase aborted
191
191
192 $ hg tglog
192 $ hg tglog
193 @ 6: 'Extra'
193 @ 6: 'Extra'
194 |
194 |
195 o 5: 'B'
195 o 5: 'B'
196 |
196 |
197 o 4: 'E'
197 o 4: 'E'
198 |
198 |
199 o 3: 'D'
199 o 3: 'D'
200 |
200 |
201 | o 2: 'C'
201 | o 2: 'C'
202 | |
202 | |
203 | o 1: 'B'
203 | o 1: 'B'
204 |/
204 |/
205 o 0: 'A'
205 o 0: 'A'
206
206
207 $ cd ..
207 $ cd ..
208
208
209 Changes during an interruption - abort (again):
209 Changes during an interruption - abort (again):
210
210
211 $ hg clone -q -u . a a3
211 $ hg clone -q -u . a a3
212 $ cd a3
212 $ cd a3
213
213
214 $ hg tglogp
214 $ hg tglogp
215 @ 4:draft 'E'
215 @ 4:draft 'E'
216 |
216 |
217 o 3:draft 'D'
217 o 3:draft 'D'
218 |
218 |
219 | o 2:draft 'C'
219 | o 2:draft 'C'
220 | |
220 | |
221 | o 1:draft 'B'
221 | o 1:draft 'B'
222 |/
222 |/
223 o 0:draft 'A'
223 o 0:draft 'A'
224
224
225 Rebasing B onto E:
225 Rebasing B onto E:
226
226
227 $ hg rebase -s 1 -d 4
227 $ hg rebase -s 1 -d 4
228 rebasing 1:27547f69f254 "B"
228 rebasing 1:27547f69f254 "B"
229 rebasing 2:965c486023db "C"
229 rebasing 2:965c486023db "C"
230 merging A
230 merging A
231 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
231 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
232 unresolved conflicts (see hg resolve, then hg rebase --continue)
232 unresolved conflicts (see hg resolve, then hg rebase --continue)
233 [1]
233 [1]
234
234
235 Change phase on B and B'
235 Change phase on B and B'
236
236
237 $ hg up -q -C 5 --config 'extensions.rebase=!'
237 $ hg up -q -C 5 --config 'extensions.rebase=!'
238 $ hg phase --public 1
238 $ hg phase --public 1
239 $ hg phase --public 5
239 $ hg phase --public 5
240 $ hg phase --secret -f 2
240 $ hg phase --secret -f 2
241
241
242 $ hg tglogp
242 $ hg tglogp
243 @ 5:public 'B'
243 @ 5:public 'B'
244 |
244 |
245 o 4:public 'E'
245 o 4:public 'E'
246 |
246 |
247 o 3:public 'D'
247 o 3:public 'D'
248 |
248 |
249 | o 2:secret 'C'
249 | o 2:secret 'C'
250 | |
250 | |
251 | o 1:public 'B'
251 | o 1:public 'B'
252 |/
252 |/
253 o 0:public 'A'
253 o 0:public 'A'
254
254
255 Abort the rebasing:
255 Abort the rebasing:
256
256
257 $ hg rebase --abort
257 $ hg rebase --abort
258 warning: can't clean up public changesets 45396c49d53b
258 warning: can't clean up public changesets 45396c49d53b
259 rebase aborted
259 rebase aborted
260
260
261 $ hg tglogp
261 $ hg tglogp
262 @ 5:public 'B'
262 @ 5:public 'B'
263 |
263 |
264 o 4:public 'E'
264 o 4:public 'E'
265 |
265 |
266 o 3:public 'D'
266 o 3:public 'D'
267 |
267 |
268 | o 2:secret 'C'
268 | o 2:secret 'C'
269 | |
269 | |
270 | o 1:public 'B'
270 | o 1:public 'B'
271 |/
271 |/
272 o 0:public 'A'
272 o 0:public 'A'
273
273
274
274
275 Test rebase interrupted by hooks
275 Test rebase interrupted by hooks
276
276
277 $ hg up 2
277 $ hg up 2
278 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
278 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
279 $ echo F > F
279 $ echo F > F
280 $ hg add F
280 $ hg add F
281 $ hg ci -m F
281 $ hg ci -m F
282
282
283 $ cd ..
283 $ cd ..
284
284
285 (precommit version)
285 (precommit version)
286
286
287 $ cp -R a3 hook-precommit
287 $ cp -R a3 hook-precommit
288 $ cd hook-precommit
288 $ cd hook-precommit
289 $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.precommit=hg status | grep "M A"'
289 $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.precommit=hg status | grep "M A"'
290 rebasing 2:965c486023db "C"
290 rebasing 2:965c486023db "C"
291 M A
291 M A
292 rebasing 6:a0b2430ebfb8 "F" (tip)
292 rebasing 6:a0b2430ebfb8 "F" (tip)
293 abort: precommit hook exited with status 1
293 abort: precommit hook exited with status 1
294 [255]
294 [255]
295 $ hg tglogp
295 $ hg tglogp
296 @ 7:secret 'C'
296 @ 7:secret 'C'
297 |
297 |
298 | @ 6:secret 'F'
298 | @ 6:secret 'F'
299 | |
299 | |
300 o | 5:public 'B'
300 o | 5:public 'B'
301 | |
301 | |
302 o | 4:public 'E'
302 o | 4:public 'E'
303 | |
303 | |
304 o | 3:public 'D'
304 o | 3:public 'D'
305 | |
305 | |
306 | o 2:secret 'C'
306 | o 2:secret 'C'
307 | |
307 | |
308 | o 1:public 'B'
308 | o 1:public 'B'
309 |/
309 |/
310 o 0:public 'A'
310 o 0:public 'A'
311
311
312 $ hg rebase --continue
312 $ hg rebase --continue
313 already rebased 2:965c486023db "C" as 401ccec5e39f
313 already rebased 2:965c486023db "C" as 401ccec5e39f
314 rebasing 6:a0b2430ebfb8 "F"
314 rebasing 6:a0b2430ebfb8 "F"
315 saved backup bundle to $TESTTMP/hook-precommit/.hg/strip-backup/965c486023db-aa6250e7-backup.hg (glob)
315 saved backup bundle to $TESTTMP/hook-precommit/.hg/strip-backup/965c486023db-aa6250e7-backup.hg (glob)
316 $ hg tglogp
316 $ hg tglogp
317 @ 6:secret 'F'
317 @ 6:secret 'F'
318 |
318 |
319 o 5:secret 'C'
319 o 5:secret 'C'
320 |
320 |
321 o 4:public 'B'
321 o 4:public 'B'
322 |
322 |
323 o 3:public 'E'
323 o 3:public 'E'
324 |
324 |
325 o 2:public 'D'
325 o 2:public 'D'
326 |
326 |
327 | o 1:public 'B'
327 | o 1:public 'B'
328 |/
328 |/
329 o 0:public 'A'
329 o 0:public 'A'
330
330
331 $ cd ..
331 $ cd ..
332
332
333 (pretxncommit version)
333 (pretxncommit version)
334
334
335 $ cp -R a3 hook-pretxncommit
335 $ cp -R a3 hook-pretxncommit
336 $ cd hook-pretxncommit
336 $ cd hook-pretxncommit
337 $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.pretxncommit=hg log -r $HG_NODE | grep "summary: C"'
337 $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.pretxncommit=hg log -r $HG_NODE | grep "summary: C"'
338 rebasing 2:965c486023db "C"
338 rebasing 2:965c486023db "C"
339 summary: C
339 summary: C
340 rebasing 6:a0b2430ebfb8 "F" (tip)
340 rebasing 6:a0b2430ebfb8 "F" (tip)
341 transaction abort!
341 transaction abort!
342 rollback completed
342 rollback completed
343 abort: pretxncommit hook exited with status 1
343 abort: pretxncommit hook exited with status 1
344 [255]
344 [255]
345 $ hg tglogp
345 $ hg tglogp
346 @ 7:secret 'C'
346 @ 7:secret 'C'
347 |
347 |
348 | @ 6:secret 'F'
348 | @ 6:secret 'F'
349 | |
349 | |
350 o | 5:public 'B'
350 o | 5:public 'B'
351 | |
351 | |
352 o | 4:public 'E'
352 o | 4:public 'E'
353 | |
353 | |
354 o | 3:public 'D'
354 o | 3:public 'D'
355 | |
355 | |
356 | o 2:secret 'C'
356 | o 2:secret 'C'
357 | |
357 | |
358 | o 1:public 'B'
358 | o 1:public 'B'
359 |/
359 |/
360 o 0:public 'A'
360 o 0:public 'A'
361
361
362 $ hg rebase --continue
362 $ hg rebase --continue
363 already rebased 2:965c486023db "C" as 401ccec5e39f
363 already rebased 2:965c486023db "C" as 401ccec5e39f
364 rebasing 6:a0b2430ebfb8 "F"
364 rebasing 6:a0b2430ebfb8 "F"
365 saved backup bundle to $TESTTMP/hook-pretxncommit/.hg/strip-backup/965c486023db-aa6250e7-backup.hg (glob)
365 saved backup bundle to $TESTTMP/hook-pretxncommit/.hg/strip-backup/965c486023db-aa6250e7-backup.hg (glob)
366 $ hg tglogp
366 $ hg tglogp
367 @ 6:secret 'F'
367 @ 6:secret 'F'
368 |
368 |
369 o 5:secret 'C'
369 o 5:secret 'C'
370 |
370 |
371 o 4:public 'B'
371 o 4:public 'B'
372 |
372 |
373 o 3:public 'E'
373 o 3:public 'E'
374 |
374 |
375 o 2:public 'D'
375 o 2:public 'D'
376 |
376 |
377 | o 1:public 'B'
377 | o 1:public 'B'
378 |/
378 |/
379 o 0:public 'A'
379 o 0:public 'A'
380
380
381 $ cd ..
381 $ cd ..
382
383 (pretxnclose version)
384
385 $ cp -R a3 hook-pretxnclose
386 $ cd hook-pretxnclose
387 $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.pretxnclose=hg log -r tip | grep "summary: C"'
388 rebasing 2:965c486023db "C"
389 summary: C
390 rebasing 6:a0b2430ebfb8 "F" (tip)
391 transaction abort!
392 rollback completed
393 abort: pretxnclose hook exited with status 1
394 [255]
395 $ hg tglogp
396 @ 7:secret 'C'
397 |
398 | @ 6:secret 'F'
399 | |
400 o | 5:public 'B'
401 | |
402 o | 4:public 'E'
403 | |
404 o | 3:public 'D'
405 | |
406 | o 2:secret 'C'
407 | |
408 | o 1:public 'B'
409 |/
410 o 0:public 'A'
411
412 $ hg rebase --continue
413 already rebased 2:965c486023db "C" as 401ccec5e39f
414 rebasing 6:a0b2430ebfb8 "F"
415 saved backup bundle to $TESTTMP/hook-pretxnclose/.hg/strip-backup/965c486023db-aa6250e7-backup.hg (glob)
416 $ hg tglogp
417 @ 6:secret 'F'
418 |
419 o 5:secret 'C'
420 |
421 o 4:public 'B'
422 |
423 o 3:public 'E'
424 |
425 o 2:public 'D'
426 |
427 | o 1:public 'B'
428 |/
429 o 0:public 'A'
430
431 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now