D11801: filemerge: rename _formatconflictmarker() since it formats a label

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Nov 24 17:05:22 UTC 2021


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

REVISION SUMMARY
  `_formatconflictmarker()`'s name made me think that it would create
  something like `<<<<<<<` and maybe some more stuff after it, but it's
  actually just the label that comes after on the same line. So let's
  rename it to `_formatlabel()`. That's better aligned with the
  variables the result is assigned it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -846,7 +846,7 @@
         return True, r, False
 
 
-def _formatconflictmarker(ctx, template, label, pad):
+def _formatlabel(ctx, template, label, pad):
     """Applies the given template to the ctx, prefixed by the label.
 
     Pad is the minimum width of the label prefix, so that multiple markers
@@ -893,11 +893,11 @@
     pad = max(len(l) for l in labels)
 
     newlabels = [
-        _formatconflictmarker(cd, tmpl, labels[0], pad),
-        _formatconflictmarker(co, tmpl, labels[1], pad),
+        _formatlabel(cd, tmpl, labels[0], pad),
+        _formatlabel(co, tmpl, labels[1], pad),
     ]
     if len(labels) > 2:
-        newlabels.append(_formatconflictmarker(ca, tmpl, labels[2], pad))
+        newlabels.append(_formatlabel(ca, tmpl, labels[2], pad))
     return newlabels
 
 



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


More information about the Mercurial-devel mailing list