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

login
register
mail settings
Submitter phabricator
Date Nov. 24, 2021, 5:05 p.m.
Message ID <differential-rev-PHID-DREV-2bv3nod4fzp5rxtsvxqd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50127/
State Superseded
Headers show

Comments

phabricator - Nov. 24, 2021, 5:05 p.m.
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




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

Patch

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