Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 4553:741f64dfc04d
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%.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 11 Jun 2007 21:09:24 -0500 |
parents | 38cdee6b6675 |
children | 9dbabb9d466c |
comparison
equal
deleted
inserted
replaced
4552:38cdee6b6675 | 4553:741f64dfc04d |
---|---|
7 | 7 |
8 from node import * | 8 from node import * |
9 from i18n import _ | 9 from i18n import _ |
10 import os, sys, mdiff, bdiff, util, templater, patch, commands | 10 import os, sys, mdiff, bdiff, util, templater, patch, commands |
11 import atexit, signal, pdb, hg, lock, fancyopts, traceback | 11 import atexit, signal, pdb, hg, lock, fancyopts, traceback |
12 import socket, revlog, version, extensions, errno | 12 import socket, revlog, version, extensions, errno, localrepo |
13 | 13 |
14 revrangesep = ':' | 14 revrangesep = ':' |
15 | 15 |
16 class UnknownCommand(Exception): | 16 class UnknownCommand(Exception): |
17 """Exception raised if command is not in the command table.""" | 17 """Exception raised if command is not in the command table.""" |
253 os.chdir(cwd) | 253 os.chdir(cwd) |
254 | 254 |
255 extensions.loadall(ui) | 255 extensions.loadall(ui) |
256 ui.addreadhook(extensions.loadall) | 256 ui.addreadhook(extensions.loadall) |
257 | 257 |
258 # read the local extension info into a local ui object | |
259 rcpath = earlygetopt(["-R", "--repository"], args) or localrepo.findrepo() | |
260 if rcpath: | |
261 try: | |
262 lui = commands.ui.ui(parentui=ui) | |
263 lui.readconfig(os.path.join(rcpath, ".hg", "hgrc")) | |
264 except IOError: | |
265 pass | |
266 | |
258 cmd, func, args, options, cmdoptions = parse(ui, args) | 267 cmd, func, args, options, cmdoptions = parse(ui, args) |
259 | 268 |
260 if options["encoding"]: | 269 if options["encoding"]: |
261 util._encoding = options["encoding"] | 270 util._encoding = options["encoding"] |
262 if options["encodingmode"]: | 271 if options["encodingmode"]: |