# HG changeset patch # User Philippe Pepiot # Date 1491482502 -7200 # Node ID f6d77af84ef3e936b15634759df2718d5363b78a # Parent fde4822b0102d8d3ecee252d721ac96272fe6b48 perf: add historical portability for util.timer util.timer has been introduced in ae5d60bb and used in perf.py since 22fbca1d. For historical portability, forcibly define util.timer in perf.py diff -r fde4822b0102 -r f6d77af84ef3 contrib/perf.py --- a/contrib/perf.py Wed Apr 05 15:31:08 2017 -0700 +++ b/contrib/perf.py Thu Apr 06 14:41:42 2017 +0200 @@ -67,6 +67,16 @@ setattr(util, 'safehasattr', safehasattr) # for "historical portability": +# define util.timer forcibly, because util.timer has been available +# since ae5d60bb70c9 +if safehasattr(time, 'perf_counter'): + util.timer = time.perf_counter +elif os.name == 'nt': + util.timer = time.clock +else: + util.timer = time.time + +# for "historical portability": # use locally defined empty option list, if formatteropts isn't # available, because commands.formatteropts has been available since # 3.2 (or 7a7eed5176a4), even though formatting itself has been diff -r fde4822b0102 -r f6d77af84ef3 tests/test-check-code.t --- a/tests/test-check-code.t Wed Apr 05 15:31:08 2017 -0700 +++ b/tests/test-check-code.t Thu Apr 06 14:41:42 2017 +0200 @@ -9,7 +9,7 @@ $ hg locate -X contrib/python-zstandard -X hgext/fsmonitor/pywatchman | > sed 's-\\-/-g' | xargs "$check_code" --warnings --per-file=0 || false - contrib/perf.py:859: + contrib/perf.py:869: > r.revision(r.node(x)) don't convert rev to node before passing to revision(nodeorrev) Skipping i18n/polib.py it has no-che?k-code (glob) diff -r fde4822b0102 -r f6d77af84ef3 tests/test-contrib-perf.t --- a/tests/test-contrib-perf.t Wed Apr 05 15:31:08 2017 -0700 +++ b/tests/test-contrib-perf.t Thu Apr 06 14:41:42 2017 +0200 @@ -165,7 +165,7 @@ $ (hg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py; > hg files -r tip glob:mercurial/*.c glob:mercurial/*.py) | > "$TESTDIR"/check-perf-code.py contrib/perf.py - contrib/perf.py:859: + contrib/perf.py:869: > r.revision(r.node(x)) don't convert rev to node before passing to revision(nodeorrev) [1]