[PATCH 4 of 4] templater: rename "right" argument of pad() function

Yuya Nishihara yuya at tcha.org
Sun Aug 21 10:53:58 EDT 2016


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1461328350 -32400
#      Fri Apr 22 21:32:30 2016 +0900
# Node ID 7b381ff884252b9c99c53f2265f112e461af8383
# Parent  741d99b3efd996c3e3d96a4a7d452b23d38fb74c
templater: rename "right" argument of pad() function

Before, right=True meant right justify, which I think is left padding.

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -504,7 +504,7 @@ def fill(context, mapping, args):
 
     return templatefilters.fill(text, width, initindent, hangindent)
 
- at templatefunc('pad(text, width[, fillchar=\' \'[, right=False]])')
+ at templatefunc('pad(text, width[, fillchar=\' \'[, left=False]])')
 def pad(context, mapping, args):
     """Pad text with a
     fill character."""
@@ -518,14 +518,14 @@ def pad(context, mapping, args):
 
     text = evalstring(context, mapping, args[0])
 
-    right = False
+    left = False
     fillchar = ' '
     if len(args) > 2:
         fillchar = evalstring(context, mapping, args[2])
     if len(args) > 3:
-        right = evalboolean(context, mapping, args[3])
+        left = evalboolean(context, mapping, args[3])
 
-    if right:
+    if left:
         return text.rjust(width, fillchar)
     else:
         return text.ljust(width, fillchar)


More information about the Mercurial-devel mailing list