changeset 44094:521b4e3a42d7

rebase: extract a variable for a repeated `repo[p1]` I'll add another use site in the next patch. Differential Revision: https://phab.mercurial-scm.org/D7896
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 13 Jan 2020 11:11:20 -0800
parents 06e7e7652ac0
children e733c59f3c09
files hgext/rebase.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Sun Dec 29 17:53:48 2019 -0800
+++ b/hgext/rebase.py	Mon Jan 13 11:11:20 2020 -0800
@@ -1469,11 +1469,12 @@
     """Rebase a single revision rev on top of p1 using base as merge ancestor"""
     # Merge phase
     # Update to destination and merge it with local
+    p1ctx = repo[p1]
     if wctx.isinmemory():
-        wctx.setbase(repo[p1])
+        wctx.setbase(p1ctx)
     else:
         if repo[b'.'].rev() != p1:
-            repo.ui.debug(b" update to %d:%s\n" % (p1, repo[p1]))
+            repo.ui.debug(b" update to %d:%s\n" % (p1, p1ctx))
             mergemod.update(repo, p1, branchmerge=False, force=True)
         else:
             repo.ui.debug(b" already in destination\n")