##// 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 s = base64.decodestring(s)
18 s = base64.decodestring(s)
19 return pickle.loads(s)
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 name = name or exe
24 name = name or exe
23 if not util.find_exe(exe):
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 class NoRepo(Exception): pass
29 class NoRepo(Exception): pass
27
30
@@ -5,7 +5,7 b''
5 # This software may be used and distributed according to the terms
5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference.
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 from cvs import convert_cvs
9 from cvs import convert_cvs
10 from darcs import darcs_source
10 from darcs import darcs_source
11 from git import convert_git
11 from git import convert_git
@@ -48,7 +48,7 b' def convertsource(ui, path, type, rev):'
48 try:
48 try:
49 if not type or name == type:
49 if not type or name == type:
50 return source(ui, path, rev)
50 return source(ui, path, rev)
51 except NoRepo, inst:
51 except (NoRepo, MissingTool), inst:
52 exceptions.append(inst)
52 exceptions.append(inst)
53 if not ui.quiet:
53 if not ui.quiet:
54 for inst in exceptions:
54 for inst in exceptions:
@@ -2,7 +2,8 b''
2
2
3 import os, re, time
3 import os, re, time
4 from mercurial import util
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 from mercurial.i18n import _
7 from mercurial.i18n import _
7
8
8 class monotone_source(converter_source, commandline):
9 class monotone_source(converter_source, commandline):
@@ -41,7 +42,7 b' class monotone_source(converter_source, '
41 if not os.path.exists(path):
42 if not os.path.exists(path):
42 raise norepo
43 raise norepo
43
44
44 checktool('mtn')
45 checktool('mtn', abort=False)
45
46
46 # test if there are any revisions
47 # test if there are any revisions
47 self.rev = None
48 self.rev = None
General Comments 0
You need to be logged in to leave comments. Login now