diff 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
line wrap: on
line diff
--- a/hgext/convert/common.py	Sun Oct 28 09:47:54 2007 +0100
+++ b/hgext/convert/common.py	Tue Oct 30 22:14:15 2007 +0100
@@ -1,6 +1,7 @@
 # common code for the convert extension
 import base64
 import cPickle as pickle
+from mercurial import util
 
 def encodeargs(args):
     def encodearg(s):
@@ -15,6 +16,11 @@
     s = base64.decodestring(s)
     return pickle.loads(s)
 
+def checktool(exe, name=None):
+    name = name or exe
+    if not util.find_exe(exe):
+        raise util.Abort('cannot find required "%s" tool' % name)
+
 class NoRepo(Exception): pass
 
 SKIPREV = 'SKIP'