changeset 43797:fb07126dadbe

graft: extract `repo['.']` to local variable It's used in two places and I'm about to use it more. Differential Revision: https://phab.mercurial-scm.org/D7548
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 05 Dec 2019 09:34:43 -0800
parents ebfd349eac46
children 32d11a23c9cf
files mercurial/merge.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Thu Dec 05 09:32:47 2019 -0800
+++ b/mercurial/merge.py	Thu Dec 05 09:34:43 2019 -0800
@@ -2605,7 +2605,8 @@
     # to copy commits), and 2) informs update that the incoming changes are
     # newer than the destination so it doesn't prompt about "remote changed foo
     # which local deleted".
-    mergeancestor = repo.changelog.isancestor(repo[b'.'].node(), ctx.node())
+    pctx = repo[b'.']
+    mergeancestor = repo.changelog.isancestor(pctx.node(), ctx.node())
 
     stats = update(
         repo,
@@ -2627,7 +2628,7 @@
             pother = parents[0].node()
 
     with repo.dirstate.parentchange():
-        repo.setparents(repo[b'.'].node(), pother)
+        repo.setparents(pctx.node(), pother)
         repo.dirstate.write(repo.currenttransaction())
         # fix up dirstate for copies and renames
         copies.duplicatecopies(repo, repo[None], ctx.rev(), base.rev())