##// END OF EJS Templates
convert: allow missing tools not to stop source type detection
Patrick Mezard -
r6332:950e72fc default
parent child Browse files
Show More
@@ -18,10 +18,13 b' def decodeargs(s):'
18 18 s = base64.decodestring(s)
19 19 return pickle.loads(s)
20 20
21 def checktool(exe, name=None):
21 class MissingTool(Exception): pass
22
23 def checktool(exe, name=None, abort=True):
22 24 name = name or exe
23 25 if not util.find_exe(exe):
24 raise util.Abort('cannot find required "%s" tool' % name)
26 exc = abort and util.Abort or MissingTool
27 raise exc(_('cannot find required "%s" tool') % name)
25 28
26 29 class NoRepo(Exception): pass
27 30
@@ -5,7 +5,7 b''
5 5 # This software may be used and distributed according to the terms
6 6 # of the GNU General Public License, incorporated herein by reference.
7 7
8 from common import NoRepo, SKIPREV, mapfile
8 from common import NoRepo, MissingTool, SKIPREV, mapfile
9 9 from cvs import convert_cvs
10 10 from darcs import darcs_source
11 11 from git import convert_git
@@ -48,7 +48,7 b' def convertsource(ui, path, type, rev):'
48 48 try:
49 49 if not type or name == type:
50 50 return source(ui, path, rev)
51 except NoRepo, inst:
51 except (NoRepo, MissingTool), inst:
52 52 exceptions.append(inst)
53 53 if not ui.quiet:
54 54 for inst in exceptions:
@@ -2,7 +2,8 b''
2 2
3 3 import os, re, time
4 4 from mercurial import util
5 from common import NoRepo, commit, converter_source, checktool, commandline
5 from common import NoRepo, MissingTool, commit, converter_source, checktool
6 from common import commandline
6 7 from mercurial.i18n import _
7 8
8 9 class monotone_source(converter_source, commandline):
@@ -41,7 +42,7 b' class monotone_source(converter_source, '
41 42 if not os.path.exists(path):
42 43 raise norepo
43 44
44 checktool('mtn')
45 checktool('mtn', abort=False)
45 46
46 47 # test if there are any revisions
47 48 self.rev = None
General Comments 0
You need to be logged in to leave comments. Login now