##// END OF EJS Templates
rebase: delete seemingly unnecessary needupdate()...
Martin von Zweigbergk -
r44505:894c91c2 default
parent child Browse files
Show More
@@ -798,7 +798,7 b' class rebaseruntime(object):'
798 shouldupdate = repo[b'.'].rev() in updateifonnodes
798 shouldupdate = repo[b'.'].rev() in updateifonnodes
799
799
800 # Update away from the rebase if necessary
800 # Update away from the rebase if necessary
801 if shouldupdate or needupdate(repo, self.state):
801 if shouldupdate:
802 mergemod.update(
802 mergemod.update(
803 repo, self.originalwd, branchmerge=False, force=True
803 repo, self.originalwd, branchmerge=False, force=True
804 )
804 )
@@ -1056,10 +1056,9 b' def rebase(ui, repo, **opts):'
1056 b'changesets'
1056 b'changesets'
1057 ),
1057 ),
1058 )
1058 )
1059 if needupdate(repo, rbsrt.state):
1059 # update to the current working revision
1060 # update to the current working revision
1060 # to clear interrupted merge
1061 # to clear interrupted merge
1061 hg.updaterepo(repo, rbsrt.originalwd, overwrite=True)
1062 hg.updaterepo(repo, rbsrt.originalwd, overwrite=True)
1063 rbsrt._finishrebase()
1062 rbsrt._finishrebase()
1064 return 0
1063 return 0
1065 elif inmemory:
1064 elif inmemory:
@@ -1924,25 +1923,6 b' def clearstatus(repo):'
1924 repo.vfs.unlinkpath(b"rebasestate", ignoremissing=True)
1923 repo.vfs.unlinkpath(b"rebasestate", ignoremissing=True)
1925
1924
1926
1925
1927 def needupdate(repo, state):
1928 '''check whether we should `update --clean` away from a merge, or if
1929 somehow the working dir got forcibly updated, e.g. by older hg'''
1930 parents = [p.rev() for p in repo[None].parents()]
1931
1932 # Are we in a merge state at all?
1933 if len(parents) < 2:
1934 return False
1935
1936 # We should be standing on the first as-of-yet unrebased commit.
1937 firstunrebased = min(
1938 [old for old, new in pycompat.iteritems(state) if new == nullrev]
1939 )
1940 if firstunrebased in parents:
1941 return True
1942
1943 return False
1944
1945
1946 def sortsource(destmap):
1926 def sortsource(destmap):
1947 """yield source revisions in an order that we only rebase things once
1927 """yield source revisions in an order that we only rebase things once
1948
1928
General Comments 0
You need to be logged in to leave comments. Login now