# HG changeset patch # User Patrick Mezard # Date 1206052363 -3600 # Node ID 950e72fc7cf37325118eaf68a5ee49af49d55180 # Parent 627665e37bdd773731bb262969f8f3b446e58568 convert: allow missing tools not to stop source type detection diff -r 627665e37bdd -r 950e72fc7cf3 hgext/convert/common.py --- a/hgext/convert/common.py Thu Mar 20 22:58:53 2008 +0100 +++ b/hgext/convert/common.py Thu Mar 20 23:32:43 2008 +0100 @@ -18,10 +18,13 @@ s = base64.decodestring(s) return pickle.loads(s) -def checktool(exe, name=None): +class MissingTool(Exception): pass + +def checktool(exe, name=None, abort=True): name = name or exe if not util.find_exe(exe): - raise util.Abort('cannot find required "%s" tool' % name) + exc = abort and util.Abort or MissingTool + raise exc(_('cannot find required "%s" tool') % name) class NoRepo(Exception): pass diff -r 627665e37bdd -r 950e72fc7cf3 hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py Thu Mar 20 22:58:53 2008 +0100 +++ b/hgext/convert/convcmd.py Thu Mar 20 23:32:43 2008 +0100 @@ -5,7 +5,7 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. -from common import NoRepo, SKIPREV, mapfile +from common import NoRepo, MissingTool, SKIPREV, mapfile from cvs import convert_cvs from darcs import darcs_source from git import convert_git @@ -48,7 +48,7 @@ try: if not type or name == type: return source(ui, path, rev) - except NoRepo, inst: + except (NoRepo, MissingTool), inst: exceptions.append(inst) if not ui.quiet: for inst in exceptions: diff -r 627665e37bdd -r 950e72fc7cf3 hgext/convert/monotone.py --- a/hgext/convert/monotone.py Thu Mar 20 22:58:53 2008 +0100 +++ b/hgext/convert/monotone.py Thu Mar 20 23:32:43 2008 +0100 @@ -2,7 +2,8 @@ import os, re, time from mercurial import util -from common import NoRepo, commit, converter_source, checktool, commandline +from common import NoRepo, MissingTool, commit, converter_source, checktool +from common import commandline from mercurial.i18n import _ class monotone_source(converter_source, commandline): @@ -41,7 +42,7 @@ if not os.path.exists(path): raise norepo - checktool('mtn') + checktool('mtn', abort=False) # test if there are any revisions self.rev = None