sapling/eden/scm/contrib/traceprof.py
Muir Manders 44343769f8 collapse edenscm.mercurial package into edenscm
Summary:
We want to rename away from "mercurial". Rather than rename the "mercurial" Python package, we opted to just collapse it into the parent "edenscm" package. This is also a step towards further organizing we want to do around the new project name.

To ease the transition wrt hotfixes, we now replace "edenscm.mercurial" with "mercurial" to fix imports within base64-python extensions.

Reviewed By: sggutier

Differential Revision: D38943169

fbshipit-source-id: 03fa18079c51e2f7fac05d65b127095da3ab7c99
2022-08-24 13:45:53 -07:00

33 lines
964 B
Python
Executable File

#!/usr/bin/env python
# Portions Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# Copyright Olivia Mackall <olivia@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 import ui as uimod
from edenscm.ext import traceprof
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())