hgext/rebase.py
changeset 44053 894c91c2e363
parent 44051 436d106de670
child 44090 2f0a44c69e07
--- 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