changeset 50697:e7ef11b75fdc

library: incorporate demandimport into runpy invocation
author Jason R. Coombs <jaraco@jaraco.com>
date Thu, 20 Apr 2023 15:56:58 -0400
parents eb01d3a65ad8
children f1b57672cb94
files mercurial/__main__.py
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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()