D6883: update: clarify calculateupdate() call sites by specifying argument names

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Sep 25 17:39:07 EDT 2019


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

REVISION SUMMARY
  merge.calculateupdate() takes a lot of parameters and I get confused
  all the time which is which.
  
  See also b14fdf1fb615 <https://phab.mercurial-scm.org/rHGb14fdf1fb615c7d674db3297c0f206c3c0f6a2d7> (update: clarify update() call sites by
  specifying argument names, 2017-02-09).

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/perf.py
  hgext/convert/hg.py
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1986,11 +1986,8 @@
                 repo, wctx, c, ancs,
                 # These parameters were determined by print-debugging
                 # what happens later on inside histedit.
-                False, # branchmerge
-                False, # force
-                False, # acceptremote
-                False, # followcopies
-            )
+                branchmerge=False, force=False, acceptremote=False,
+                followcopies=False)
         except error.Abort:
             raise error.Abort(
        _("untracked files in working directory conflict with files in %s") % (
diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -204,12 +204,8 @@
         anc = [p1ctx.ancestor(p2ctx)]
         # Calculate what files are coming from p2
         actions, diverge, rename = mergemod.calculateupdates(
-            self.repo, p1ctx, p2ctx, anc,
-            True,  # branchmerge
-            True,  # force
-            False, # acceptremote
-            False, # followcopies
-        )
+            self.repo, p1ctx, p2ctx, anc, branchmerge=True,
+            force=True, acceptremote=False, followcopies=False)
 
         for file, (action, info, msg) in actions.iteritems():
             if source.targetfilebelongstosource(file):
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1030,8 +1030,9 @@
     def d():
         # acceptremote is True because we don't want prompts in the middle of
         # our benchmark
-        merge.calculateupdates(repo, wctx, rctx, [ancestor], False, False,
-                               acceptremote=True, followcopies=True)
+        merge.calculateupdates(repo, wctx, rctx, [ancestor], branchmerge=False,
+                               force=False, acceptremote=True,
+                               followcopies=True)
     timer(d)
     fm.end()
 



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


More information about the Mercurial-devel mailing list