Mercurial > hg
changeset 19516:fe78eb7bcca0 stable
rebase: don't clobber wd on --abort when we've updated away (issue4009)
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 01 Aug 2013 17:33:09 -0500 |
parents | 14c91b18d798 |
children | eab2ff59481e |
files | hgext/rebase.py |
diffstat | 1 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/rebase.py Fri Jul 26 13:34:51 2013 -0700 +++ b/hgext/rebase.py Thu Aug 01 17:33:09 2013 -0500 @@ -592,6 +592,18 @@ raise raise util.Abort(_('no rebase in progress')) +def inrebase(repo, originalwd, state): + '''check whether the workdir is in an interrupted rebase''' + parents = [p.rev() for p in repo.parents()] + if originalwd in parents: + return True + + for newrev in state.itervalues(): + if newrev in parents: + return True + + return False + def abort(repo, originalwd, target, state): 'Restore the repository to its original state' dstates = [s for s in state.values() if s != nullrev] @@ -609,8 +621,11 @@ "can't abort\n")) return -1 else: + # Update away from the rebase if necessary + if inrebase(repo, originalwd, state): + merge.update(repo, repo[originalwd].rev(), False, True, False) + # Strip from the first rebased revision - merge.update(repo, repo[originalwd].rev(), False, True, False) rebased = filter(lambda x: x > -1 and x != target, state.values()) if rebased: strippoints = [c.node() for c in repo.set('roots(%ld)', rebased)]