changeset 50534:057639af827c

hg: move unreachable code to where it could be reached
author Jason R. Coombs <jaraco@jaraco.com>
date Thu, 20 Apr 2023 16:07:47 -0400
parents f4a540c203d7
children a8531bd9210b
files hg
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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