diff mercurial/cmdutil.py @ 4684:849f011dbf79

Remember path to 'hg' executable and pass to external tools and hooks as $HG.
author Thomas Arendsen Hein <thomas@intevation.de>
date Sat, 23 Jun 2007 20:21:10 +0200
parents 150afe6becf6
children a741293793f6
line wrap: on
line diff
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -20,7 +20,7 @@ class AmbiguousCommand(Exception):
 class ParseError(Exception):
     """Exception raised on errors in parsing the command line."""
 
-def runcatch(ui, args):
+def runcatch(ui, args, argv0=None):
     def catchterm(*args):
         raise util.SignalInterrupt
 
@@ -34,7 +34,7 @@ def runcatch(ui, args):
             if '--debugger' in args:
                 pdb.set_trace()
             try:
-                return dispatch(ui, args)
+                return dispatch(ui, args, argv0=argv0)
             finally:
                 ui.flush()
         except:
@@ -255,7 +255,10 @@ def earlygetopt(aliases, args):
             return args[args.index(opt) + 1]
     return None
 
-def dispatch(ui, args):
+def dispatch(ui, args, argv0=None):
+    # remember how to call 'hg' before changing the working dir
+    util.set_hgexecutable(argv0)
+
     # check for cwd first
     cwd = earlygetopt(['--cwd'], args)
     if cwd: