changeset 2555:d6605381c6df

hg.py: move exception handling code to try to avoid hiding errors
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sun, 02 Jul 2006 22:39:39 -0300
parents 8264c2034970
children f1ebc4311f47
files mercurial/hg.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Mon Jul 03 14:30:38 2006 -0700
+++ b/mercurial/hg.py	Sun Jul 02 22:39:39 2006 -0300
@@ -63,11 +63,11 @@
     if scheme:
         c = scheme.find(':')
         scheme = c >= 0 and scheme[:c]
-    try:
-        ctor = schemes.get(scheme) or schemes['file']
-        if create:
+    ctor = schemes.get(scheme) or schemes['file']
+    if create:
+        try:
             return ctor(ui, path, create)
-        return ctor(ui, path)
-    except TypeError:
-        raise util.Abort(_('cannot create new repository over "%s" protocol') %
-                         scheme)
+        except TypeError:
+            raise util.Abort(_('cannot create new repository over "%s" protocol') %
+                             scheme)
+    return ctor(ui, path)