comparison hgext/convert/common.py @ 5497:f0a3918abd42

convert: fail if an external required tool is not found
author Patrick Mezard <pmezard@gmail.com>
date Tue, 30 Oct 2007 22:14:15 +0100
parents 71e7c86adcb7
children 11d7908a3ea8
comparison
equal deleted inserted replaced
5496:5bff70ff0431 5497:f0a3918abd42
1 # common code for the convert extension 1 # common code for the convert extension
2 import base64 2 import base64
3 import cPickle as pickle 3 import cPickle as pickle
4 from mercurial import util
4 5
5 def encodeargs(args): 6 def encodeargs(args):
6 def encodearg(s): 7 def encodearg(s):
7 lines = base64.encodestring(s) 8 lines = base64.encodestring(s)
8 lines = [l.splitlines()[0] for l in lines] 9 lines = [l.splitlines()[0] for l in lines]
12 return encodearg(s) 13 return encodearg(s)
13 14
14 def decodeargs(s): 15 def decodeargs(s):
15 s = base64.decodestring(s) 16 s = base64.decodestring(s)
16 return pickle.loads(s) 17 return pickle.loads(s)
18
19 def checktool(exe, name=None):
20 name = name or exe
21 if not util.find_exe(exe):
22 raise util.Abort('cannot find required "%s" tool' % name)
17 23
18 class NoRepo(Exception): pass 24 class NoRepo(Exception): pass
19 25
20 SKIPREV = 'SKIP' 26 SKIPREV = 'SKIP'
21 27