# HG changeset patch # User Martin von Zweigbergk # Date 1578700059 28800 # Node ID 894c91c2e3635f70c1bb315d98dadc859bd021cd # Parent b74270da5eee70682d6087b7c77abbf205df2945 rebase: delete seemingly unnecessary needupdate() This seemed to be about checking that the user hasn't updated away when we asked them to resolve merge conflicts. These days we call `cmdutil.checkunfinished()` and refuse to update, so the user shouldn't be able to get into this state. `test-rebase-interruptions.t` actually has some tests where it disables the rebase extension in order to be allowed to do some of these updates. That still passes, but I wouldn't personally haved cared if that failed. Differential Revision: https://phab.mercurial-scm.org/D7825 diff -r b74270da5eee -r 894c91c2e363 hgext/rebase.py --- a/hgext/rebase.py Fri Jan 10 13:24:25 2020 -0800 +++ b/hgext/rebase.py Fri Jan 10 15:47:39 2020 -0800 @@ -798,7 +798,7 @@ shouldupdate = repo[b'.'].rev() in updateifonnodes # Update away from the rebase if necessary - if shouldupdate or needupdate(repo, self.state): + if shouldupdate: mergemod.update( repo, self.originalwd, branchmerge=False, force=True ) @@ -1056,10 +1056,9 @@ b'changesets' ), ) - if needupdate(repo, rbsrt.state): - # update to the current working revision - # to clear interrupted merge - hg.updaterepo(repo, rbsrt.originalwd, overwrite=True) + # update to the current working revision + # to clear interrupted merge + hg.updaterepo(repo, rbsrt.originalwd, overwrite=True) rbsrt._finishrebase() return 0 elif inmemory: @@ -1924,25 +1923,6 @@ repo.vfs.unlinkpath(b"rebasestate", ignoremissing=True) -def needupdate(repo, state): - '''check whether we should `update --clean` away from a merge, or if - somehow the working dir got forcibly updated, e.g. by older hg''' - parents = [p.rev() for p in repo[None].parents()] - - # Are we in a merge state at all? - if len(parents) < 2: - return False - - # We should be standing on the first as-of-yet unrebased commit. - firstunrebased = min( - [old for old, new in pycompat.iteritems(state) if new == nullrev] - ) - if firstunrebased in parents: - return True - - return False - - def sortsource(destmap): """yield source revisions in an order that we only rebase things once