##// END OF EJS Templates
rebase: don't clobber wd on --abort when we've updated away (issue4009)
Matt Mackall -
r19516:fe78eb7b stable
parent child Browse files
Show More
@@ -592,6 +592,18 b' def restorestatus(repo):'
592 raise
592 raise
593 raise util.Abort(_('no rebase in progress'))
593 raise util.Abort(_('no rebase in progress'))
594
594
595 def inrebase(repo, originalwd, state):
596 '''check whether the workdir is in an interrupted rebase'''
597 parents = [p.rev() for p in repo.parents()]
598 if originalwd in parents:
599 return True
600
601 for newrev in state.itervalues():
602 if newrev in parents:
603 return True
604
605 return False
606
595 def abort(repo, originalwd, target, state):
607 def abort(repo, originalwd, target, state):
596 'Restore the repository to its original state'
608 'Restore the repository to its original state'
597 dstates = [s for s in state.values() if s != nullrev]
609 dstates = [s for s in state.values() if s != nullrev]
@@ -609,8 +621,11 b' def abort(repo, originalwd, target, stat'
609 "can't abort\n"))
621 "can't abort\n"))
610 return -1
622 return -1
611 else:
623 else:
624 # Update away from the rebase if necessary
625 if inrebase(repo, originalwd, state):
626 merge.update(repo, repo[originalwd].rev(), False, True, False)
627
612 # Strip from the first rebased revision
628 # Strip from the first rebased revision
613 merge.update(repo, repo[originalwd].rev(), False, True, False)
614 rebased = filter(lambda x: x > -1 and x != target, state.values())
629 rebased = filter(lambda x: x > -1 and x != target, state.values())
615 if rebased:
630 if rebased:
616 strippoints = [c.node() for c in repo.set('roots(%ld)', rebased)]
631 strippoints = [c.node() for c in repo.set('roots(%ld)', rebased)]
General Comments 0
You need to be logged in to leave comments. Login now