D7780: util: avoid referencing `time.clock()` on Windows when missing (issue6238)
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Wed Jan 8 19:50:18 UTC 2020
Closed by commit rHGf9d29e1d3354: util: avoid referencing `time.clock()` on Windows when missing (issue6238) (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D7780?vs=19028&id=19092
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D7780/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D7780
AFFECTED FILES
mercurial/util.py
CHANGE DETAILS
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2057,16 +2057,17 @@
)
+timer = getattr(time, "perf_counter", None)
+
if pycompat.iswindows:
checkosfilename = checkwinfilename
- timer = time.clock
+ if not timer:
+ timer = time.clock
else:
# mercurial.windows doesn't have platform.checkosfilename
checkosfilename = platform.checkosfilename # pytype: disable=module-attr
- timer = time.time
-
-if safehasattr(time, "perf_counter"):
- timer = time.perf_counter
+ if not timer:
+ timer = time.time
def makelock(info, pathname):
To: mharbison72, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list