D6200: perf: make perf.run-limits code work with Python 3

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Apr 5 07:57:54 EDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG912d82daeda3: perf: make perf.run-limits code work with Python 3 (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6200?vs=14659&id=14665

REVISION DETAIL
  https://phab.mercurial-scm.org/D6200

AFFECTED FILES
  contrib/perf.py
  tests/test-contrib-perf.t

CHANGE DETAILS

diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t
--- a/tests/test-contrib-perf.t
+++ b/tests/test-contrib-perf.t
@@ -260,7 +260,8 @@
   malformatted run limit entry, missing "-": 500
   ! wall * comb * user * sys * (best of 5) (glob)
   $ hg perfparents --config perf.stub=no --config perf.run-limits='aaa-12, 0.000000001-5'
-  malformatted run limit entry, could not convert string to float: aaa: aaa-12
+  malformatted run limit entry, could not convert string to float: aaa: aaa-12 (no-py3 !)
+  malformatted run limit entry, could not convert string to float: 'aaa': aaa-12 (py3 !)
   ! wall * comb * user * sys * (best of 5) (glob)
   $ hg perfparents --config perf.stub=no --config perf.run-limits='12-aaaaaa, 0.000000001-5'
   malformatted run limit entry, invalid literal for int() with base 10: 'aaaaaa': 12-aaaaaa
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -316,22 +316,22 @@
     limitspec = ui.configlist(b"perf", b"run-limits", [])
     limits = []
     for item in limitspec:
-        parts = item.split('-', 1)
+        parts = item.split(b'-', 1)
         if len(parts) < 2:
-            ui.warn(('malformatted run limit entry, missing "-": %s\n'
+            ui.warn((b'malformatted run limit entry, missing "-": %s\n'
                      % item))
             continue
         try:
-            time_limit = float(parts[0])
+            time_limit = float(pycompat.sysstr(parts[0]))
         except ValueError as e:
-            ui.warn(('malformatted run limit entry, %s: %s\n'
-                     % (e, item)))
+            ui.warn((b'malformatted run limit entry, %s: %s\n'
+                     % (pycompat.bytestr(e), item)))
             continue
         try:
-            run_limit = int(parts[1])
+            run_limit = int(pycompat.sysstr(parts[1]))
         except ValueError as e:
-            ui.warn(('malformatted run limit entry, %s: %s\n'
-                     % (e, item)))
+            ui.warn((b'malformatted run limit entry, %s: %s\n'
+                     % (pycompat.bytestr(e), item)))
             continue
         limits.append((time_limit, run_limit))
     if not limits:



To: indygreg, #hg-reviewers, pulkit
Cc: mjpieters, mercurial-devel


More information about the Mercurial-devel mailing list