py3: drop use of str() in dagparser.py
authorYuya Nishihara <yuya@tcha.org>
Sun, 03 Sep 2017 15:25:50 +0900
changeset 34210 8927534cacbc
parent 34209 da9c4b0693c5
child 34211 a48ad118c558
py3: drop use of str() in dagparser.py
mercurial/dagparser.py
--- a/mercurial/dagparser.py	Sun Sep 03 15:22:54 2017 +0900
+++ b/mercurial/dagparser.py	Sun Sep 03 15:25:50 2017 +0900
@@ -11,7 +11,10 @@
 import string
 
 from .i18n import _
-from . import error
+from . import (
+    error,
+    util,
+)
 
 def parsedag(desc):
     '''parses a DAG from a concise textual description; generates events
@@ -314,7 +317,7 @@
                 if len(ps) == 1 and ps[0] == -1:
                     if needroot:
                         if run:
-                            yield '+' + str(run)
+                            yield '+%d' % run
                             run = 0
                         if wrapnonlinear:
                             yield '\n'
@@ -329,7 +332,7 @@
                         run += 1
                 else:
                     if run:
-                        yield '+' + str(run)
+                        yield '+%d' % run
                         run = 0
                     if wrapnonlinear:
                         yield '\n'
@@ -340,11 +343,11 @@
                         elif p in labels:
                             prefs.append(labels[p])
                         else:
-                            prefs.append(str(r - p))
+                            prefs.append('%d' % (r - p))
                     yield '*' + '/'.join(prefs)
             else:
                 if run:
-                    yield '+' + str(run)
+                    yield '+%d' % run
                     run = 0
                 if kind == 'l':
                     rid, name = data
@@ -367,10 +370,12 @@
                     yield '#' + data
                     yield '\n'
                 else:
-                    raise error.Abort(_("invalid event type in dag: %s")
-                                      % str((kind, data)))
+                    raise error.Abort(_("invalid event type in dag: "
+                                        "('%s', '%s')")
+                                      % (util.escapestr(kind),
+                                         util.escapestr(data)))
         if run:
-            yield '+' + str(run)
+            yield '+%d' % run
 
     line = ''
     for part in gen():