##// END OF EJS Templates
perf: don't depend on pycompat for older Mercurial versions...
Martin von Zweigbergk -
r43053:c0000597 default
parent child Browse files
Show More
@@ -126,6 +126,7 b' try:'
126 getargspec = pycompat.getargspec # added to module after 4.5
126 getargspec = pycompat.getargspec # added to module after 4.5
127 _byteskwargs = pycompat.byteskwargs # since 4.1 (or fbc3f73dc802)
127 _byteskwargs = pycompat.byteskwargs # since 4.1 (or fbc3f73dc802)
128 _sysstr = pycompat.sysstr # since 4.0 (or 2219f4f82ede)
128 _sysstr = pycompat.sysstr # since 4.0 (or 2219f4f82ede)
129 _bytestr = pycompat.bytestr # since 4.2 (or b70407bd84d5)
129 _xrange = pycompat.xrange # since 4.8 (or 7eba8f83129b)
130 _xrange = pycompat.xrange # since 4.8 (or 7eba8f83129b)
130 fsencode = pycompat.fsencode # since 3.9 (or f4a5e0e86a7e)
131 fsencode = pycompat.fsencode # since 3.9 (or f4a5e0e86a7e)
131 if pycompat.ispy3:
132 if pycompat.ispy3:
@@ -136,6 +137,7 b' except (NameError, ImportError, Attribut'
136 import inspect
137 import inspect
137 getargspec = inspect.getargspec
138 getargspec = inspect.getargspec
138 _byteskwargs = identity
139 _byteskwargs = identity
140 _bytestr = str
139 fsencode = identity # no py3 support
141 fsencode = identity # no py3 support
140 _maxint = sys.maxint # no py3 support
142 _maxint = sys.maxint # no py3 support
141 _sysstr = lambda x: x # no py3 support
143 _sysstr = lambda x: x # no py3 support
@@ -381,16 +383,16 b' def gettimer(ui, opts=None):'
381 % item))
383 % item))
382 continue
384 continue
383 try:
385 try:
384 time_limit = float(pycompat.sysstr(parts[0]))
386 time_limit = float(_sysstr(parts[0]))
385 except ValueError as e:
387 except ValueError as e:
386 ui.warn((b'malformatted run limit entry, %s: %s\n'
388 ui.warn((b'malformatted run limit entry, %s: %s\n'
387 % (pycompat.bytestr(e), item)))
389 % (_bytestr(e), item)))
388 continue
390 continue
389 try:
391 try:
390 run_limit = int(pycompat.sysstr(parts[1]))
392 run_limit = int(_sysstr(parts[1]))
391 except ValueError as e:
393 except ValueError as e:
392 ui.warn((b'malformatted run limit entry, %s: %s\n'
394 ui.warn((b'malformatted run limit entry, %s: %s\n'
393 % (pycompat.bytestr(e), item)))
395 % (_bytestr(e), item)))
394 continue
396 continue
395 limits.append((time_limit, run_limit))
397 limits.append((time_limit, run_limit))
396 if not limits:
398 if not limits:
@@ -3085,7 +3087,7 b' def perfprogress(ui, topic=None, total=N'
3085
3087
3086 def doprogress():
3088 def doprogress():
3087 with ui.makeprogress(topic, total=total) as progress:
3089 with ui.makeprogress(topic, total=total) as progress:
3088 for i in pycompat.xrange(total):
3090 for i in _xrange(total):
3089 progress.increment()
3091 progress.increment()
3090
3092
3091 timer(doprogress)
3093 timer(doprogress)
General Comments 0
You need to be logged in to leave comments. Login now