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

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 21, 2016, 2:53 p.m.
Message ID <7b381ff884252b9c99c5.1471791238@mimosa>
Download mbox | patch
Permalink /patch/16375/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 21, 2016, 2:53 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.
Pierre-Yves David - Aug. 22, 2016, 12:20 p.m.
On 08/21/2016 04:53 PM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@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

Pushed, thanks!

Patch

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)
 
-@templatefunc('pad(text, width[, fillchar=\' \'[, right=False]])')
+@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)