Mercurial > hg
changeset 5521:03496d4fa509
convert: display all errors if we couldn't open the source repo
This should give the user a better hint of what's going wrong.
Improve some error messages. In particular, mention "CVS checkout" instead
of "CVS repo".
Fixes issue822 and issue826.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 09 Nov 2007 20:21:35 -0200 |
parents | cc3af86ab6fe |
children | f5345a2d2391 |
files | hgext/convert/__init__.py hgext/convert/cvs.py hgext/convert/darcs.py hgext/convert/git.py hgext/convert/hg.py hgext/convert/subversion.py |
diffstat | 6 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/__init__.py Fri Nov 09 20:21:35 2007 -0200 +++ b/hgext/convert/__init__.py Fri Nov 09 20:21:35 2007 -0200 @@ -32,12 +32,16 @@ ] def convertsource(ui, path, type, rev): + exceptions = [] for name, source in source_converters: try: if not type or name == type: return source(ui, path, rev) except NoRepo, inst: - ui.note(_("convert: %s\n") % inst) + exceptions.append(inst) + if not ui.quiet: + for inst in exceptions: + ui.write(_("%s\n") % inst) raise util.Abort('%s: unknown repository type' % path) def convertsink(ui, path, type):
--- a/hgext/convert/cvs.py Fri Nov 09 20:21:35 2007 -0200 +++ b/hgext/convert/cvs.py Fri Nov 09 20:21:35 2007 -0200 @@ -11,7 +11,7 @@ cvs = os.path.join(path, "CVS") if not os.path.exists(cvs): - raise NoRepo("couldn't open CVS repo %s" % path) + raise NoRepo("%s does not look like a CVS checkout" % path) self.changeset = {} self.files = {}
--- a/hgext/convert/darcs.py Fri Nov 09 20:21:35 2007 -0200 +++ b/hgext/convert/darcs.py Fri Nov 09 20:21:35 2007 -0200 @@ -24,13 +24,13 @@ # check for _darcs, ElementTree, _darcs/inventory so that we can # easily skip test-convert-darcs if ElementTree is not around if not os.path.exists(os.path.join(path, '_darcs')): - raise NoRepo("couldn't open darcs repo %s" % path) + raise NoRepo("%s does not look like a darcs repo" % path) if ElementTree is None: raise util.Abort(_("Python ElementTree module is not available")) if not os.path.exists(os.path.join(path, '_darcs', 'inventory')): - raise NoRepo("couldn't open darcs repo %s" % path) + raise NoRepo("%s does not look like a darcs repo" % path) self.path = os.path.realpath(path)
--- a/hgext/convert/git.py Fri Nov 09 20:21:35 2007 -0200 +++ b/hgext/convert/git.py Fri Nov 09 20:21:35 2007 -0200 @@ -30,7 +30,7 @@ if os.path.isdir(path + "/.git"): path += "/.git" if not os.path.exists(path + "/objects"): - raise NoRepo("couldn't open GIT repo %s" % path) + raise NoRepo("%s does not look like a Git repo" % path) self.path = path def getheads(self):
--- a/hgext/convert/hg.py Fri Nov 09 20:21:35 2007 -0200 +++ b/hgext/convert/hg.py Fri Nov 09 20:21:35 2007 -0200 @@ -190,7 +190,7 @@ self.repo.heads() except hg.RepoError: ui.print_exc() - raise NoRepo("could not open hg repo %s as source" % path) + raise NoRepo("%s does not look like a Mercurial repo" % path) self.lastrev = None self.lastctx = None self._changescache = None
--- a/hgext/convert/subversion.py Fri Nov 09 20:21:35 2007 -0200 +++ b/hgext/convert/subversion.py Fri Nov 09 20:21:35 2007 -0200 @@ -102,7 +102,7 @@ try: SubversionException except NameError: - raise NoRepo('subversion python bindings could not be loaded') + raise NoRepo('Subversion python bindings could not be loaded') self.encoding = locale.getpreferredencoding() self.lastrevs = {} @@ -131,7 +131,7 @@ 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) + raise NoRepo("%s does not look like a Subversion repo" % self.url) if rev: try: