py3: use pycompat.bytestr() or '%d' in place of str()
authorPulkit Goyal <7895pulkit@gmail.com>
Wed, 29 Nov 2017 08:39:48 +0530
changeset 35203 4ee493ea1c13
parent 35202 760fef6aca74
child 35204 d4b108fdf423
py3: use pycompat.bytestr() or '%d' in place of str() Differential Revision: https://phab.mercurial-scm.org/D1556
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Fri Dec 01 17:39:21 2017 +1100
+++ b/mercurial/cmdutil.py	Wed Nov 29 08:39:48 2017 +0530
@@ -823,9 +823,9 @@
                   total=None, seqno=None, revwidth=None, pathname=None):
     node_expander = {
         'H': lambda: hex(node),
-        'R': lambda: str(repo.changelog.rev(node)),
+        'R': lambda: '%d' % repo.changelog.rev(node),
         'h': lambda: short(node),
-        'm': lambda: re.sub('[^\w]', '_', str(desc))
+        'm': lambda: re.sub('[^\w]', '_', desc or '')
         }
     expander = {
         '%': lambda: '%',
@@ -837,13 +837,13 @@
             expander.update(node_expander)
         if node:
             expander['r'] = (lambda:
-                    str(repo.changelog.rev(node)).zfill(revwidth or 0))
+                    ('%d' % repo.changelog.rev(node)).zfill(revwidth or 0))
         if total is not None:
-            expander['N'] = lambda: str(total)
+            expander['N'] = lambda: '%d' % total
         if seqno is not None:
-            expander['n'] = lambda: str(seqno)
+            expander['n'] = lambda: '%d' % seqno
         if total is not None and seqno is not None:
-            expander['n'] = lambda: str(seqno).zfill(len(str(total)))
+            expander['n'] = (lambda: ('%d' % seqno).zfill(len('%d' % total)))
         if pathname is not None:
             expander['s'] = lambda: os.path.basename(pathname)
             expander['d'] = lambda: os.path.dirname(pathname) or '.'