mercurial/cmdutil.py
changeset 4686 849f011dbf79
parent 4671 150afe6becf6
child 4714 a741293793f6
--- a/mercurial/cmdutil.py	Sat Jun 23 12:05:00 2007 +0200
+++ b/mercurial/cmdutil.py	Sat Jun 23 20:21:10 2007 +0200
@@ -20,7 +20,7 @@
 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 @@
             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 @@
             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: