259 # check for cwd first |
259 # check for cwd first |
260 cwd = earlygetopt(['--cwd'], args) |
260 cwd = earlygetopt(['--cwd'], args) |
261 if cwd: |
261 if cwd: |
262 os.chdir(cwd) |
262 os.chdir(cwd) |
263 |
263 |
264 extensions.loadall(ui) |
|
265 |
|
266 # read the local repository .hgrc into a local ui object |
264 # read the local repository .hgrc into a local ui object |
267 # this will trigger its extensions to load |
265 # this will trigger its extensions to load |
268 path = earlygetopt(["-R", "--repository", "--repo"], args) |
266 path = earlygetopt(["-R", "--repository", "--repo"], args) |
269 if not path: |
267 if not path: |
270 path = findrepo() or "" |
268 path = findrepo() or "" |
|
269 lui = ui |
271 if path: |
270 if path: |
272 try: |
271 try: |
273 lui = commands.ui.ui(parentui=ui) |
272 lui = commands.ui.ui(parentui=ui) |
274 lui.readconfig(os.path.join(path, ".hg", "hgrc")) |
273 lui.readconfig(os.path.join(path, ".hg", "hgrc")) |
275 extensions.loadall(lui) |
|
276 except IOError: |
274 except IOError: |
277 extensions.loadall(ui) |
275 pass |
|
276 |
|
277 extensions.loadall(lui) |
|
278 # check for fallback encoding |
|
279 fallback = lui.config('ui', 'fallbackencoding') |
|
280 if fallback: |
|
281 util._fallbackencoding = fallback |
278 |
282 |
279 cmd, func, args, options, cmdoptions = parse(ui, args) |
283 cmd, func, args, options, cmdoptions = parse(ui, args) |
280 |
284 |
281 if options["encoding"]: |
285 if options["encoding"]: |
282 util._encoding = options["encoding"] |
286 util._encoding = options["encoding"] |