D7896: rebase: extract a variable for a repeated `repo[p1]`

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Jan 16 01:21:52 UTC 2020


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'll add another use site in the next patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7896

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -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")



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list