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 # read the local repository .hgrc into a local ui object |
264 # read the local repository .hgrc into a local ui object |
265 # this will trigger its extensions to load |
265 path = findrepo() or "" |
266 path = earlygetopt(["-R", "--repository", "--repo"], args) |
|
267 if not path: |
266 if not path: |
268 path = findrepo() or "" |
267 lui = ui |
269 lui = ui |
|
270 if path: |
268 if path: |
271 try: |
269 try: |
272 lui = commands.ui.ui(parentui=ui) |
270 lui = commands.ui.ui(parentui=ui) |
273 lui.readconfig(os.path.join(path, ".hg", "hgrc")) |
271 lui.readconfig(os.path.join(path, ".hg", "hgrc")) |
274 except IOError: |
272 except IOError: |
275 pass |
273 pass |
|
274 |
|
275 # now we can expand paths, even ones in .hg/hgrc |
|
276 rpath = earlygetopt(["-R", "--repository", "--repo"], args) |
|
277 if rpath: |
|
278 path = lui.expandpath(rpath) |
|
279 lui = commands.ui.ui(parentui=ui) |
|
280 lui.readconfig(os.path.join(path, ".hg", "hgrc")) |
276 |
281 |
277 extensions.loadall(lui) |
282 extensions.loadall(lui) |
278 # check for fallback encoding |
283 # check for fallback encoding |
279 fallback = lui.config('ui', 'fallbackencoding') |
284 fallback = lui.config('ui', 'fallbackencoding') |
280 if fallback: |
285 if fallback: |