changeset 32034:579bbcb4322b

templatekw: eliminate unnecessary temporary variable 'names' from _showlist() Replace 'names' with the optional argument 'plural'.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 05 Apr 2017 21:27:44 +0900
parents 0e9fece17db1
children f4ba33454b28
files mercurial/templatekw.py
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatekw.py	Mon Apr 17 20:22:00 2017 +0200
+++ b/mercurial/templatekw.py	Wed Apr 05 21:27:44 2017 +0900
@@ -106,11 +106,10 @@
     expand 'end_foos'.
     '''
     templ = args['templ']
-    if plural:
-        names = plural
-    else: names = name + 's'
+    if not plural:
+        plural = name + 's'
     if not values:
-        noname = 'no_' + names
+        noname = 'no_' + plural
         if noname in templ:
             yield templ(noname, **args)
         return
@@ -121,7 +120,7 @@
             for v in values:
                 yield dict(v, **args)
         return
-    startname = 'start_' + names
+    startname = 'start_' + plural
     if startname in templ:
         yield templ(startname, **args)
     vargs = args.copy()
@@ -144,7 +143,7 @@
         yield one(v)
     if last is not None:
         yield one(last, tag=lastname)
-    endname = 'end_' + names
+    endname = 'end_' + plural
     if endname in templ:
         yield templ(endname, **args)