dispatch: parse and apply -R early
This allows us to use extensions specified in .hg/hgrc. Unfortunately,
this requires us to parse that file twice, but performance impact on
the version command appears to be less than 1%.
--- a/mercurial/cmdutil.py Mon Jun 11 21:09:24 2007 -0500
+++ b/mercurial/cmdutil.py Mon Jun 11 21:09:24 2007 -0500
@@ -9,7 +9,7 @@
from i18n import _
import os, sys, mdiff, bdiff, util, templater, patch, commands
import atexit, signal, pdb, hg, lock, fancyopts, traceback
-import socket, revlog, version, extensions, errno
+import socket, revlog, version, extensions, errno, localrepo
revrangesep = ':'
@@ -255,6 +255,15 @@
extensions.loadall(ui)
ui.addreadhook(extensions.loadall)
+ # read the local extension info into a local ui object
+ rcpath = earlygetopt(["-R", "--repository"], args) or localrepo.findrepo()
+ if rcpath:
+ try:
+ lui = commands.ui.ui(parentui=ui)
+ lui.readconfig(os.path.join(rcpath, ".hg", "hgrc"))
+ except IOError:
+ pass
+
cmd, func, args, options, cmdoptions = parse(ui, args)
if options["encoding"]: