convert: report errors more meaningfully if run with --traceback
authorBryan O'Sullivan <bos@serpentine.com>
Wed, 10 Oct 2007 00:15:33 -0700
changeset 5437 4d34f8b12a9e
parent 5435 0d154bce2341
child 5438 6fa5258be3d4
convert: report errors more meaningfully if run with --traceback
hgext/convert/hg.py
hgext/convert/subversion.py
--- a/hgext/convert/hg.py	Tue Oct 09 08:39:37 2007 -0700
+++ b/hgext/convert/hg.py	Wed Oct 10 00:15:33 2007 -0700
@@ -174,7 +174,11 @@
         converter_source.__init__(self, ui, path, rev)
         try:
             self.repo = hg.repository(self.ui, path)
-        except:
+            # try to provoke an exception if this isn't really a hg
+            # repo, but some other bogus compatible-looking url
+            self.repo.heads()
+        except hg.RepoError:
+            ui.print_exc()
             raise NoRepo("could not open hg repo %s as source" % path)
         self.lastrev = None
         self.lastctx = None
--- a/hgext/convert/subversion.py	Tue Oct 09 08:39:37 2007 -0700
+++ b/hgext/convert/subversion.py	Wed Oct 10 00:15:33 2007 -0700
@@ -128,6 +128,7 @@
             self.paths = {}
             self.uuid = svn.ra.get_uuid(self.ra).decode(self.encoding)
         except SubversionException, e:
+            ui.print_exc()
             raise NoRepo("couldn't open SVN repo %s" % self.url)
 
         if rev: