D6745: perf: don't depend on pycompat for older Mercurial versions

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Aug 20 11:36:33 EDT 2019


Closed by commit rHG1b0af23c71c1: perf: don't depend on pycompat for older Mercurial versions (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6745?vs=16265&id=16274

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6745/new/

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

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -126,6 +126,7 @@
     getargspec = pycompat.getargspec  # added to module after 4.5
     _byteskwargs = pycompat.byteskwargs  # since 4.1 (or fbc3f73dc802)
     _sysstr = pycompat.sysstr         # since 4.0 (or 2219f4f82ede)
+    _bytestr = pycompat.bytestr       # since 4.2 (or b70407bd84d5)
     _xrange = pycompat.xrange         # since 4.8 (or 7eba8f83129b)
     fsencode = pycompat.fsencode      # since 3.9 (or f4a5e0e86a7e)
     if pycompat.ispy3:
@@ -136,6 +137,7 @@
     import inspect
     getargspec = inspect.getargspec
     _byteskwargs = identity
+    _bytestr = str
     fsencode = identity               # no py3 support
     _maxint = sys.maxint              # no py3 support
     _sysstr = lambda x: x             # no py3 support
@@ -357,16 +359,16 @@
                      % item))
             continue
         try:
-            time_limit = float(pycompat.sysstr(parts[0]))
+            time_limit = float(_sysstr(parts[0]))
         except ValueError as e:
             ui.warn((b'malformatted run limit entry, %s: %s\n'
-                     % (pycompat.bytestr(e), item)))
+                     % (_bytestr(e), item)))
             continue
         try:
-            run_limit = int(pycompat.sysstr(parts[1]))
+            run_limit = int(_sysstr(parts[1]))
         except ValueError as e:
             ui.warn((b'malformatted run limit entry, %s: %s\n'
-                     % (pycompat.bytestr(e), item)))
+                     % (_bytestr(e), item)))
             continue
         limits.append((time_limit, run_limit))
     if not limits:
@@ -3061,7 +3063,7 @@
 
     def doprogress():
         with ui.makeprogress(topic, total=total) as progress:
-            for i in pycompat.xrange(total):
+            for i in _xrange(total):
                 progress.increment()
 
     timer(doprogress)



To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list