Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/filemerge.py @ 48395:1eeec02cd919
filemerge: rename _formatconflictmarker() since it formats a label
`_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.
Differential Revision: https://phab.mercurial-scm.org/D11801
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 19 Nov 2021 18:14:25 -0800 |
parents | 053dd53a0b59 |
children | 6ce9ccfcac23 |
comparison
equal
deleted
inserted
replaced
48394:d5a91701f7dc | 48395:1eeec02cd919 |
---|---|
844 r = 1 | 844 r = 1 |
845 repo.ui.debug(b'merge tool returned: %d\n' % r) | 845 repo.ui.debug(b'merge tool returned: %d\n' % r) |
846 return True, r, False | 846 return True, r, False |
847 | 847 |
848 | 848 |
849 def _formatconflictmarker(ctx, template, label, pad): | 849 def _formatlabel(ctx, template, label, pad): |
850 """Applies the given template to the ctx, prefixed by the label. | 850 """Applies the given template to the ctx, prefixed by the label. |
851 | 851 |
852 Pad is the minimum width of the label prefix, so that multiple markers | 852 Pad is the minimum width of the label prefix, so that multiple markers |
853 can have aligned templated parts. | 853 can have aligned templated parts. |
854 """ | 854 """ |
891 ) | 891 ) |
892 | 892 |
893 pad = max(len(l) for l in labels) | 893 pad = max(len(l) for l in labels) |
894 | 894 |
895 newlabels = [ | 895 newlabels = [ |
896 _formatconflictmarker(cd, tmpl, labels[0], pad), | 896 _formatlabel(cd, tmpl, labels[0], pad), |
897 _formatconflictmarker(co, tmpl, labels[1], pad), | 897 _formatlabel(co, tmpl, labels[1], pad), |
898 ] | 898 ] |
899 if len(labels) > 2: | 899 if len(labels) > 2: |
900 newlabels.append(_formatconflictmarker(ca, tmpl, labels[2], pad)) | 900 newlabels.append(_formatlabel(ca, tmpl, labels[2], pad)) |
901 return newlabels | 901 return newlabels |
902 | 902 |
903 | 903 |
904 def partextras(labels): | 904 def partextras(labels): |
905 """Return a dictionary of extra labels for use in prompts to the user | 905 """Return a dictionary of extra labels for use in prompts to the user |