hg: move unreachable code to where it could be reached
authorJason R. Coombs <jaraco@jaraco.com>
Thu, 20 Apr 2023 16:07:47 -0400
changeset 50534 057639af827c
parent 50533 f4a540c203d7
child 50535 a8531bd9210b
hg: move unreachable code to where it could be reached
hg
--- a/hg	Tue May 23 01:39:47 2023 +0200
+++ b/hg	Thu Apr 20 16:07:47 2023 -0400
@@ -38,21 +38,21 @@
             )
         )
 
-from hgdemandimport import tracing
+try:
+    from hgdemandimport import tracing
+except ImportError:
+    sys.stderr.write(
+        "abort: couldn't find mercurial libraries in [%s]\n"
+        % ' '.join(sys.path)
+    )
+    sys.stderr.write("(check your install and PYTHONPATH)\n")
+    sys.exit(-1)
 
 with tracing.log('hg script'):
     # enable importing on demand to reduce startup time
-    try:
-        import hgdemandimport
+    import hgdemandimport
 
-        hgdemandimport.enable()
-    except ImportError:
-        sys.stderr.write(
-            "abort: couldn't find mercurial libraries in [%s]\n"
-            % ' '.join(sys.path)
-        )
-        sys.stderr.write("(check your install and PYTHONPATH)\n")
-        sys.exit(-1)
+    hgdemandimport.enable()
 
     from mercurial import dispatch