D6471: merge: reorder some initialization to make more sense

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Jun 1 07:32:24 UTC 2019


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

REVISION SUMMARY
  This puts the closely related definitions of "pl", "p1", "p2", "pas"
  close together, and moves the definition of "overwrite" away and
  closer to where it's first used.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1977,13 +1977,10 @@
             wc = repo[None]
         pl = wc.parents()
         p1 = pl[0]
+        p2 = repo[node]
         pas = [None]
         if ancestor is not None:
             pas = [repo[ancestor]]
-
-        overwrite = force and not branchmerge
-
-        p2 = repo[node]
         if pas[0] is None:
             if repo.ui.configlist('merge', 'preferancestor') == ['*']:
                 cahs = repo.changelog.commonancestorsheads(p1.node(), p2.node())
@@ -1993,6 +1990,7 @@
 
         fp1, fp2, xp1, xp2 = p1.node(), p2.node(), bytes(p1), bytes(p2)
 
+        overwrite = force and not branchmerge
         ### check phase
         if not overwrite:
             if len(pl) > 1:



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


More information about the Mercurial-devel mailing list