mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
052e7c3877
Summary: Update `contrib/check-code.py` to Python 3. Mostly it was already compatible, however stricter regular expression parsing revealed a case where one of our tests wasn't working, and as a result lots of instances of `open(file).read()` existed that this test should have caught. I have fixed up most of the instances in the code, although there are many in the test suite that I have ignored for now. Reviewed By: quark-zju Differential Revision: D21427212 fbshipit-source-id: 7461a7c391e0ade947f779a2b476ca937fd24a8d
32 lines
968 B
Python
Executable File
32 lines
968 B
Python
Executable File
#!/usr/bin/env python
|
|
# Portions Copyright (c) Facebook, Inc. and its affiliates.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2.
|
|
|
|
# Copyright Matt Mackall <mpm@selenic.com> and others
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2 or any later version.
|
|
|
|
from __future__ import absolute_import, print_function
|
|
|
|
import os
|
|
import sys
|
|
|
|
from edenscm.hgext import traceprof
|
|
from edenscm.mercurial import ui as uimod
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.argv = sys.argv[1:]
|
|
if not sys.argv:
|
|
print("usage: traceprof.py <script> <arguments...>", file=sys.stderr)
|
|
sys.exit(2)
|
|
sys.path.insert(0, os.path.abspath(os.path.dirname(sys.argv[0])))
|
|
u = uimod.ui()
|
|
u.setconfig("traceprof", "timethreshold", 0)
|
|
with traceprof.profile(u, sys.stderr):
|
|
with open(sys.argv[0]) as f:
|
|
exec(f.read())
|