##// END OF EJS Templates
py3: make test-contrib-perf.t work on python 3...
Pulkit Goyal -
r40569:b456b2e0 default
parent child Browse files
Show More
@@ -75,6 +75,7 b' try:'
75 _byteskwargs = pycompat.byteskwargs # since 4.1 (or fbc3f73dc802)
75 _byteskwargs = pycompat.byteskwargs # since 4.1 (or fbc3f73dc802)
76 _sysstr = pycompat.sysstr # since 4.0 (or 2219f4f82ede)
76 _sysstr = pycompat.sysstr # since 4.0 (or 2219f4f82ede)
77 _xrange = pycompat.xrange # since 4.8 (or 7eba8f83129b)
77 _xrange = pycompat.xrange # since 4.8 (or 7eba8f83129b)
78 fsencode = pycompat.fsencode # since 3.9 (or f4a5e0e86a7e)
78 if pycompat.ispy3:
79 if pycompat.ispy3:
79 _maxint = sys.maxsize # per py3 docs for replacing maxint
80 _maxint = sys.maxsize # per py3 docs for replacing maxint
80 else:
81 else:
@@ -83,6 +84,7 b' except (ImportError, AttributeError):'
83 import inspect
84 import inspect
84 getargspec = inspect.getargspec
85 getargspec = inspect.getargspec
85 _byteskwargs = identity
86 _byteskwargs = identity
87 fsencode = identity # no py3 support
86 _maxint = sys.maxint # no py3 support
88 _maxint = sys.maxint # no py3 support
87 _sysstr = lambda x: x # no py3 support
89 _sysstr = lambda x: x # no py3 support
88 _xrange = xrange
90 _xrange = xrange
@@ -968,7 +970,7 b' def perfindex(ui, repo, **opts):'
968 def perfstartup(ui, repo, **opts):
970 def perfstartup(ui, repo, **opts):
969 opts = _byteskwargs(opts)
971 opts = _byteskwargs(opts)
970 timer, fm = gettimer(ui, opts)
972 timer, fm = gettimer(ui, opts)
971 cmd = sys.argv[0]
973 cmd = fsencode(sys.argv[0])
972 def d():
974 def d():
973 if os.name != r'nt':
975 if os.name != r'nt':
974 os.system(b"HGRCPATH= %s version -q > /dev/null" % cmd)
976 os.system(b"HGRCPATH= %s version -q > /dev/null" % cmd)
@@ -1387,17 +1389,18 b' def perfdiffwd(ui, repo, **opts):'
1387 opts = _byteskwargs(opts)
1389 opts = _byteskwargs(opts)
1388 timer, fm = gettimer(ui, opts)
1390 timer, fm = gettimer(ui, opts)
1389 options = {
1391 options = {
1390 b'w': b'ignore_all_space',
1392 'w': 'ignore_all_space',
1391 b'b': b'ignore_space_change',
1393 'b': 'ignore_space_change',
1392 b'B': b'ignore_blank_lines',
1394 'B': 'ignore_blank_lines',
1393 }
1395 }
1394
1396
1395 for diffopt in (b'', b'w', b'b', b'B', b'wB'):
1397 for diffopt in ('', 'w', 'b', 'B', 'wB'):
1396 opts = dict((options[c], b'1') for c in diffopt)
1398 opts = dict((options[c], b'1') for c in diffopt)
1397 def d():
1399 def d():
1398 ui.pushbuffer()
1400 ui.pushbuffer()
1399 commands.diff(ui, repo, **opts)
1401 commands.diff(ui, repo, **opts)
1400 ui.popbuffer()
1402 ui.popbuffer()
1403 diffopt = diffopt.encode('ascii')
1401 title = b'diffopts: %s' % (diffopt and (b'-' + diffopt) or b'none')
1404 title = b'diffopts: %s' % (diffopt and (b'-' + diffopt) or b'none')
1402 timer(d, title)
1405 timer(d, title)
1403 fm.end()
1406 fm.end()
@@ -1773,7 +1776,7 b' def perfrevlogrevision(ui, repo, file_, '
1773 data = segmentforrevs(chain[0], chain[-1])[1]
1776 data = segmentforrevs(chain[0], chain[-1])[1]
1774 rawchunks = getrawchunks(data, chain)
1777 rawchunks = getrawchunks(data, chain)
1775 bins = r._chunks(chain)
1778 bins = r._chunks(chain)
1776 text = str(bins[0])
1779 text = bytes(bins[0])
1777 bins = bins[1:]
1780 bins = bins[1:]
1778 text = mdiff.patches(text, bins)
1781 text = mdiff.patches(text, bins)
1779
1782
@@ -85,6 +85,7 b' test-context.py'
85 test-contrib-check-code.t
85 test-contrib-check-code.t
86 test-contrib-check-commit.t
86 test-contrib-check-commit.t
87 test-contrib-dumprevlog.t
87 test-contrib-dumprevlog.t
88 test-contrib-perf.t
88 test-contrib-testparseutil.t
89 test-contrib-testparseutil.t
89 test-convert-authormap.t
90 test-convert-authormap.t
90 test-convert-clonebranches.t
91 test-convert-clonebranches.t
General Comments 0
You need to be logged in to leave comments. Login now