Show More
@@ -343,7 +343,7 b' class rebaseruntime(object):' | |||||
343 | if dest.closesbranch() and not self.keepbranchesf: |
|
343 | if dest.closesbranch() and not self.keepbranchesf: | |
344 | self.ui.status(_('reopening closed branch head %s\n') % dest) |
|
344 | self.ui.status(_('reopening closed branch head %s\n') % dest) | |
345 |
|
345 | |||
346 |
def _performrebase(self |
|
346 | def _performrebase(self): | |
347 | repo, ui, opts = self.repo, self.ui, self.opts |
|
347 | repo, ui, opts = self.repo, self.ui, self.opts | |
348 | if self.keepbranchesf: |
|
348 | if self.keepbranchesf: | |
349 | # insert _savebranch at the start of extrafns so if |
|
349 | # insert _savebranch at the start of extrafns so if | |
@@ -395,7 +395,7 b' class rebaseruntime(object):' | |||||
395 | self.state, |
|
395 | self.state, | |
396 | self.destancestors, |
|
396 | self.destancestors, | |
397 | self.obsoletenotrebased) |
|
397 | self.obsoletenotrebased) | |
398 |
self.storestatus( |
|
398 | self.storestatus() | |
399 | storecollapsemsg(repo, self.collapsemsg) |
|
399 | storecollapsemsg(repo, self.collapsemsg) | |
400 | if len(repo[None].parents()) == 2: |
|
400 | if len(repo[None].parents()) == 2: | |
401 | repo.ui.debug('resuming interrupted rebase\n') |
|
401 | repo.ui.debug('resuming interrupted rebase\n') | |
@@ -480,24 +480,12 b' class rebaseruntime(object):' | |||||
480 | editopt = True |
|
480 | editopt = True | |
481 | editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) |
|
481 | editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) | |
482 | revtoreuse = max(self.state) |
|
482 | revtoreuse = max(self.state) | |
483 | dsguard = dirstateguard.dirstateguard(repo, 'rebase') |
|
483 | newnode = concludenode(repo, revtoreuse, p1, self.external, | |
484 | try: |
|
484 | commitmsg=commitmsg, | |
485 | newnode = concludenode(repo, revtoreuse, p1, self.external, |
|
485 | extrafn=_makeextrafn(self.extrafns), | |
486 |
|
|
486 | editor=editor, | |
487 |
|
|
487 | keepbranches=self.keepbranchesf, | |
488 |
|
|
488 | date=self.date) | |
489 | keepbranches=self.keepbranchesf, |
|
|||
490 | date=self.date) |
|
|||
491 | dsguard.close() |
|
|||
492 | release(dsguard) |
|
|||
493 | except error.InterventionRequired: |
|
|||
494 | dsguard.close() |
|
|||
495 | release(dsguard) |
|
|||
496 | raise |
|
|||
497 | except Exception: |
|
|||
498 | release(dsguard) |
|
|||
499 | raise |
|
|||
500 |
|
||||
501 | if newnode is None: |
|
489 | if newnode is None: | |
502 | newrev = self.dest |
|
490 | newrev = self.dest | |
503 | else: |
|
491 | else: | |
@@ -734,20 +722,7 b' def rebase(ui, repo, **opts):' | |||||
734 | if retcode is not None: |
|
722 | if retcode is not None: | |
735 | return retcode |
|
723 | return retcode | |
736 |
|
724 | |||
737 | with repo.transaction('rebase') as tr: |
|
725 | rbsrt._performrebase() | |
738 | dsguard = dirstateguard.dirstateguard(repo, 'rebase') |
|
|||
739 | try: |
|
|||
740 | rbsrt._performrebase(tr) |
|
|||
741 | dsguard.close() |
|
|||
742 | release(dsguard) |
|
|||
743 | except error.InterventionRequired: |
|
|||
744 | dsguard.close() |
|
|||
745 | release(dsguard) |
|
|||
746 | tr.close() |
|
|||
747 | raise |
|
|||
748 | except Exception: |
|
|||
749 | release(dsguard) |
|
|||
750 | raise |
|
|||
751 | rbsrt._finishrebase() |
|
726 | rbsrt._finishrebase() | |
752 |
|
727 | |||
753 | def _definesets(ui, repo, destf=None, srcf=None, basef=None, revf=None, |
|
728 | def _definesets(ui, repo, destf=None, srcf=None, basef=None, revf=None, | |
@@ -873,28 +848,33 b' def concludenode(repo, rev, p1, p2, comm' | |||||
873 | '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev |
|
848 | '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev | |
874 | but also store useful information in extra. |
|
849 | but also store useful information in extra. | |
875 | Return node of committed revision.''' |
|
850 | Return node of committed revision.''' | |
876 | repo.setparents(repo[p1].node(), repo[p2].node()) |
|
851 | dsguard = dirstateguard.dirstateguard(repo, 'rebase') | |
877 | ctx = repo[rev] |
|
852 | try: | |
878 | if commitmsg is None: |
|
853 | repo.setparents(repo[p1].node(), repo[p2].node()) | |
879 | commitmsg = ctx.description() |
|
854 | ctx = repo[rev] | |
880 | keepbranch = keepbranches and repo[p1].branch() != ctx.branch() |
|
855 | if commitmsg is None: | |
881 | extra = {'rebase_source': ctx.hex()} |
|
856 | commitmsg = ctx.description() | |
882 | if extrafn: |
|
857 | keepbranch = keepbranches and repo[p1].branch() != ctx.branch() | |
883 | extrafn(ctx, extra) |
|
858 | extra = {'rebase_source': ctx.hex()} | |
|
859 | if extrafn: | |||
|
860 | extrafn(ctx, extra) | |||
884 |
|
861 | |||
885 | destphase = max(ctx.phase(), phases.draft) |
|
862 | destphase = max(ctx.phase(), phases.draft) | |
886 | overrides = {('phases', 'new-commit'): destphase} |
|
863 | overrides = {('phases', 'new-commit'): destphase} | |
887 | with repo.ui.configoverride(overrides, 'rebase'): |
|
864 | with repo.ui.configoverride(overrides, 'rebase'): | |
888 | if keepbranch: |
|
865 | if keepbranch: | |
889 | repo.ui.setconfig('ui', 'allowemptycommit', True) |
|
866 | repo.ui.setconfig('ui', 'allowemptycommit', True) | |
890 | # Commit might fail if unresolved files exist |
|
867 | # Commit might fail if unresolved files exist | |
891 | if date is None: |
|
868 | if date is None: | |
892 | date = ctx.date() |
|
869 | date = ctx.date() | |
893 | newnode = repo.commit(text=commitmsg, user=ctx.user(), |
|
870 | newnode = repo.commit(text=commitmsg, user=ctx.user(), | |
894 | date=date, extra=extra, editor=editor) |
|
871 | date=date, extra=extra, editor=editor) | |
895 |
|
872 | |||
896 | repo.dirstate.setbranch(repo[newnode].branch()) |
|
873 | repo.dirstate.setbranch(repo[newnode].branch()) | |
897 | return newnode |
|
874 | dsguard.close() | |
|
875 | return newnode | |||
|
876 | finally: | |||
|
877 | release(dsguard) | |||
898 |
|
878 | |||
899 | def rebasenode(repo, rev, p1, base, state, collapse, dest): |
|
879 | def rebasenode(repo, rev, p1, base, state, collapse, dest): | |
900 | 'Rebase a single revision rev on top of p1 using base as merge ancestor' |
|
880 | 'Rebase a single revision rev on top of p1 using base as merge ancestor' |
@@ -220,11 +220,13 b' Configure a merge tool that runs status ' | |||||
220 | > test.args=$TESTTMP/mergetool-race.sh \$output |
|
220 | > test.args=$TESTTMP/mergetool-race.sh \$output | |
221 | > EOF |
|
221 | > EOF | |
222 |
|
222 | |||
|
223 | BROKEN: the "M b" line should not be there | |||
223 | $ hg rebase -s . -d 3 --tool test |
|
224 | $ hg rebase -s . -d 3 --tool test | |
224 | rebasing 4:b08445fd6b2a "c4" (tip) |
|
225 | rebasing 4:b08445fd6b2a "c4" (tip) | |
225 | merging a |
|
226 | merging a | |
226 | custom merge tool |
|
227 | custom merge tool | |
227 | M a |
|
228 | M a | |
|
229 | M b | |||
228 | ? a.orig |
|
230 | ? a.orig | |
229 | custom merge tool end |
|
231 | custom merge tool end | |
230 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/* (glob) |
|
232 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/* (glob) |
@@ -374,11 +374,10 b' test aborting an interrupted series (iss' | |||||
374 | $ hg --config extensions.n=$TESTDIR/failfilemerge.py rebase -s 3 -d tip |
|
374 | $ hg --config extensions.n=$TESTDIR/failfilemerge.py rebase -s 3 -d tip | |
375 | rebasing 3:3a71550954f1 "b" |
|
375 | rebasing 3:3a71550954f1 "b" | |
376 | rebasing 4:e80b69427d80 "c" |
|
376 | rebasing 4:e80b69427d80 "c" | |
377 | transaction abort! |
|
|||
378 | rollback completed |
|
|||
379 | abort: ^C |
|
377 | abort: ^C | |
380 | [255] |
|
378 | [255] | |
381 | $ hg rebase --abort |
|
379 | $ hg rebase --abort | |
|
380 | saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg (glob) | |||
382 | rebase aborted |
|
381 | rebase aborted | |
383 | $ hg log -G --template "{rev} {desc} {bookmarks}" |
|
382 | $ hg log -G --template "{rev} {desc} {bookmarks}" | |
384 | o 6 no-a |
|
383 | o 6 no-a | |
@@ -399,7 +398,7 b' test aborting an interrupted series (iss' | |||||
399 | parent: 0:df4f53cec30a |
|
398 | parent: 0:df4f53cec30a | |
400 | base |
|
399 | base | |
401 | branch: default |
|
400 | branch: default | |
402 |
commit: |
|
401 | commit: (clean) | |
403 | update: 6 new changesets (update) |
|
402 | update: 6 new changesets (update) | |
404 | phases: 7 draft |
|
403 | phases: 7 draft | |
405 |
|
404 |
@@ -572,8 +572,6 b' Interactions between collapse and keepbr' | |||||
572 | o 0: 'A' |
|
572 | o 0: 'A' | |
573 |
|
573 | |||
574 | $ hg rebase --keepbranches --collapse -s 1 -d 3 |
|
574 | $ hg rebase --keepbranches --collapse -s 1 -d 3 | |
575 | transaction abort! |
|
|||
576 | rollback completed |
|
|||
577 | abort: cannot collapse multiple named branches |
|
575 | abort: cannot collapse multiple named branches | |
578 | [255] |
|
576 | [255] | |
579 |
|
577 |
@@ -226,6 +226,7 b' Check that the right ancestors is used w' | |||||
226 | ignoring null merge rebase of 8 |
|
226 | ignoring null merge rebase of 8 | |
227 | rebasing 9:e31216eec445 "more changes to f1" |
|
227 | rebasing 9:e31216eec445 "more changes to f1" | |
228 | future parents are 2 and -1 |
|
228 | future parents are 2 and -1 | |
|
229 | rebase status stored | |||
229 | update to 2:4bc80088dc6b |
|
230 | update to 2:4bc80088dc6b | |
230 | resolving manifests |
|
231 | resolving manifests | |
231 | branchmerge: False, force: True, partial: False |
|
232 | branchmerge: False, force: True, partial: False | |
@@ -248,9 +249,11 b' Check that the right ancestors is used w' | |||||
248 | f1.txt |
|
249 | f1.txt | |
249 | committing manifest |
|
250 | committing manifest | |
250 | committing changelog |
|
251 | committing changelog | |
|
252 | updating the branch cache | |||
251 | rebased as 19c888675e13 |
|
253 | rebased as 19c888675e13 | |
252 | rebasing 10:2f2496ddf49d "merge" (tip) |
|
254 | rebasing 10:2f2496ddf49d "merge" (tip) | |
253 | future parents are 11 and 7 |
|
255 | future parents are 11 and 7 | |
|
256 | rebase status stored | |||
254 | already in destination |
|
257 | already in destination | |
255 | merge against 10:2f2496ddf49d |
|
258 | merge against 10:2f2496ddf49d | |
256 | detach base 9:e31216eec445 |
|
259 | detach base 9:e31216eec445 | |
@@ -266,10 +269,9 b' Check that the right ancestors is used w' | |||||
266 | f1.txt |
|
269 | f1.txt | |
267 | committing manifest |
|
270 | committing manifest | |
268 | committing changelog |
|
271 | committing changelog | |
|
272 | updating the branch cache | |||
269 | rebased as 2a7f09cac94c |
|
273 | rebased as 2a7f09cac94c | |
270 | rebase merging completed |
|
274 | rebase merging completed | |
271 | rebase status stored |
|
|||
272 | updating the branch cache |
|
|||
273 | update back to initial working directory parent |
|
275 | update back to initial working directory parent | |
274 | resolving manifests |
|
276 | resolving manifests | |
275 | branchmerge: False, force: False, partial: False |
|
277 | branchmerge: False, force: False, partial: False |
@@ -271,6 +271,162 b' Abort the rebasing:' | |||||
271 | |/ |
|
271 | |/ | |
272 | o 0:public 'A' |
|
272 | o 0:public 'A' | |
273 |
|
273 | |||
|
274 | Test rebase interrupted by hooks | |||
|
275 | ||||
|
276 | $ hg up 2 | |||
|
277 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
278 | $ echo F > F | |||
|
279 | $ hg add F | |||
|
280 | $ hg ci -m F | |||
|
281 | ||||
|
282 | $ cd .. | |||
|
283 | ||||
|
284 | (precommit version) | |||
|
285 | ||||
|
286 | $ cp -R a3 hook-precommit | |||
|
287 | $ cd hook-precommit | |||
|
288 | $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.precommit=hg status | grep "M A"' | |||
|
289 | rebasing 2:965c486023db "C" | |||
|
290 | M A | |||
|
291 | rebasing 6:a0b2430ebfb8 "F" (tip) | |||
|
292 | abort: precommit hook exited with status 1 | |||
|
293 | [255] | |||
|
294 | $ hg tglogp | |||
|
295 | @ 7:secret 'C' | |||
|
296 | | | |||
|
297 | | @ 6:secret 'F' | |||
|
298 | | | | |||
|
299 | o | 5:public 'B' | |||
|
300 | | | | |||
|
301 | o | 4:public 'E' | |||
|
302 | | | | |||
|
303 | o | 3:public 'D' | |||
|
304 | | | | |||
|
305 | | o 2:secret 'C' | |||
|
306 | | | | |||
|
307 | | o 1:public 'B' | |||
|
308 | |/ | |||
|
309 | o 0:public 'A' | |||
|
310 | ||||
|
311 | $ hg rebase --continue | |||
|
312 | already rebased 2:965c486023db "C" as 401ccec5e39f | |||
|
313 | rebasing 6:a0b2430ebfb8 "F" | |||
|
314 | saved backup bundle to $TESTTMP/hook-precommit/.hg/strip-backup/965c486023db-aa6250e7-backup.hg (glob) | |||
|
315 | $ hg tglogp | |||
|
316 | @ 6:secret 'F' | |||
|
317 | | | |||
|
318 | o 5:secret 'C' | |||
|
319 | | | |||
|
320 | o 4:public 'B' | |||
|
321 | | | |||
|
322 | o 3:public 'E' | |||
|
323 | | | |||
|
324 | o 2:public 'D' | |||
|
325 | | | |||
|
326 | | o 1:public 'B' | |||
|
327 | |/ | |||
|
328 | o 0:public 'A' | |||
|
329 | ||||
|
330 | $ cd .. | |||
|
331 | ||||
|
332 | (pretxncommit version) | |||
|
333 | ||||
|
334 | $ cp -R a3 hook-pretxncommit | |||
|
335 | $ cd hook-pretxncommit | |||
|
336 | $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.pretxncommit=hg log -r $HG_NODE | grep "summary: C"' | |||
|
337 | rebasing 2:965c486023db "C" | |||
|
338 | summary: C | |||
|
339 | rebasing 6:a0b2430ebfb8 "F" (tip) | |||
|
340 | transaction abort! | |||
|
341 | rollback completed | |||
|
342 | abort: pretxncommit hook exited with status 1 | |||
|
343 | [255] | |||
|
344 | $ hg tglogp | |||
|
345 | @ 7:secret 'C' | |||
|
346 | | | |||
|
347 | | @ 6:secret 'F' | |||
|
348 | | | | |||
|
349 | o | 5:public 'B' | |||
|
350 | | | | |||
|
351 | o | 4:public 'E' | |||
|
352 | | | | |||
|
353 | o | 3:public 'D' | |||
|
354 | | | | |||
|
355 | | o 2:secret 'C' | |||
|
356 | | | | |||
|
357 | | o 1:public 'B' | |||
|
358 | |/ | |||
|
359 | o 0:public 'A' | |||
|
360 | ||||
|
361 | $ hg rebase --continue | |||
|
362 | already rebased 2:965c486023db "C" as 401ccec5e39f | |||
|
363 | rebasing 6:a0b2430ebfb8 "F" | |||
|
364 | saved backup bundle to $TESTTMP/hook-pretxncommit/.hg/strip-backup/965c486023db-aa6250e7-backup.hg (glob) | |||
|
365 | $ hg tglogp | |||
|
366 | @ 6:secret 'F' | |||
|
367 | | | |||
|
368 | o 5:secret 'C' | |||
|
369 | | | |||
|
370 | o 4:public 'B' | |||
|
371 | | | |||
|
372 | o 3:public 'E' | |||
|
373 | | | |||
|
374 | o 2:public 'D' | |||
|
375 | | | |||
|
376 | | o 1:public 'B' | |||
|
377 | |/ | |||
|
378 | o 0:public 'A' | |||
|
379 | ||||
|
380 | $ cd .. | |||
|
381 | ||||
|
382 | (pretxnclose version) | |||
|
383 | ||||
|
384 | $ cp -R a3 hook-pretxnclose | |||
|
385 | $ cd hook-pretxnclose | |||
|
386 | $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.pretxnclose=hg log -r tip | grep "summary: C"' | |||
|
387 | rebasing 2:965c486023db "C" | |||
|
388 | summary: C | |||
|
389 | rebasing 6:a0b2430ebfb8 "F" (tip) | |||
|
390 | transaction abort! | |||
|
391 | rollback completed | |||
|
392 | abort: pretxnclose hook exited with status 1 | |||
|
393 | [255] | |||
|
394 | $ hg tglogp | |||
|
395 | @ 7:secret 'C' | |||
|
396 | | | |||
|
397 | | @ 6:secret 'F' | |||
|
398 | | | | |||
|
399 | o | 5:public 'B' | |||
|
400 | | | | |||
|
401 | o | 4:public 'E' | |||
|
402 | | | | |||
|
403 | o | 3:public 'D' | |||
|
404 | | | | |||
|
405 | | o 2:secret 'C' | |||
|
406 | | | | |||
|
407 | | o 1:public 'B' | |||
|
408 | |/ | |||
|
409 | o 0:public 'A' | |||
|
410 | ||||
|
411 | $ hg rebase --continue | |||
|
412 | already rebased 2:965c486023db "C" as 401ccec5e39f | |||
|
413 | rebasing 6:a0b2430ebfb8 "F" | |||
|
414 | saved backup bundle to $TESTTMP/hook-pretxnclose/.hg/strip-backup/965c486023db-aa6250e7-backup.hg (glob) | |||
|
415 | $ hg tglogp | |||
|
416 | @ 6:secret 'F' | |||
|
417 | | | |||
|
418 | o 5:secret 'C' | |||
|
419 | | | |||
|
420 | o 4:public 'B' | |||
|
421 | | | |||
|
422 | o 3:public 'E' | |||
|
423 | | | |||
|
424 | o 2:public 'D' | |||
|
425 | | | |||
|
426 | | o 1:public 'B' | |||
|
427 | |/ | |||
|
428 | o 0:public 'A' | |||
|
429 | ||||
274 | $ cd .. |
|
430 | $ cd .. | |
275 |
|
431 | |||
276 | Make sure merge state is cleaned up after a no-op rebase merge (issue5494) |
|
432 | Make sure merge state is cleaned up after a no-op rebase merge (issue5494) | |
@@ -302,4 +458,3 b' Make sure merge state is cleaned up afte' | |||||
302 | $ hg resolve --list |
|
458 | $ hg resolve --list | |
303 | $ test -f .hg/merge |
|
459 | $ test -f .hg/merge | |
304 | [1] |
|
460 | [1] | |
305 |
|
@@ -271,8 +271,6 b' G onto B - merge revision with both pare' | |||||
271 |
|
271 | |||
272 | $ hg rebase -s 6 -d 1 |
|
272 | $ hg rebase -s 6 -d 1 | |
273 | rebasing 6:eea13746799a "G" |
|
273 | rebasing 6:eea13746799a "G" | |
274 | transaction abort! |
|
|||
275 | rollback completed |
|
|||
276 | abort: cannot use revision 6 as base, result would have 3 parents |
|
274 | abort: cannot use revision 6 as base, result would have 3 parents | |
277 | [255] |
|
275 | [255] | |
278 | $ hg rebase --abort |
|
276 | $ hg rebase --abort |
General Comments 0
You need to be logged in to leave comments.
Login now