library: incorporate demandimport into runpy invocation
authorJason R. Coombs <jaraco@jaraco.com>
Thu, 20 Apr 2023 15:56:58 -0400
changeset 50697 e7ef11b75fdc
parent 50696 eb01d3a65ad8
child 50698 f1b57672cb94
library: incorporate demandimport into runpy invocation
mercurial/__main__.py
--- a/mercurial/__main__.py	Mon Apr 17 09:38:52 2023 -0400
+++ b/mercurial/__main__.py	Thu Apr 20 15:56:58 2023 -0400
@@ -1,4 +1,12 @@
+def run():
+    from . import demandimport
+
+    with demandimport.tracing.log('hg script'):
+        demandimport.enable()
+        from . import dispatch
+
+        dispatch.run()
+
+
 if __name__ == '__main__':
-    from . import dispatch
-
-    dispatch.run()
+    run()