# HG changeset patch # User Matt Mackall # Date 2007-06-18 18:24:34 # Node ID 5fd7cc89754248126c440e109aa3e49d0ad7a85a # Parent 7c8f8b7363655d2f8856df7dd8de5919aab701be encoding: pull fallbackencoding out of localrepo into early parsing diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -261,20 +261,24 @@ def dispatch(ui, args): if cwd: os.chdir(cwd) - extensions.loadall(ui) - # read the local repository .hgrc into a local ui object # this will trigger its extensions to load path = earlygetopt(["-R", "--repository", "--repo"], args) if not path: path = findrepo() or "" + lui = ui if path: try: lui = commands.ui.ui(parentui=ui) lui.readconfig(os.path.join(path, ".hg", "hgrc")) - extensions.loadall(lui) except IOError: - extensions.loadall(ui) + pass + + extensions.loadall(lui) + # check for fallback encoding + fallback = lui.config('ui', 'fallbackencoding') + if fallback: + util._fallbackencoding = fallback cmd, func, args, options, cmdoptions = parse(ui, args) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -80,10 +80,6 @@ class localrepository(repo.repository): except IOError: pass - fallback = self.ui.config('ui', 'fallbackencoding') - if fallback: - util._fallbackencoding = fallback - self.tagscache = None self.branchcache = None self.nodetagscache = None diff --git a/tests/test-extension.out b/tests/test-extension.out --- a/tests/test-extension.out +++ b/tests/test-extension.out @@ -1,5 +1,5 @@ uisetup called -ui.parentui is None +ui.parentui isnot None reposetup called for a ui == repo.ui Foo @@ -15,7 +15,7 @@ ui.parentui is None Bar % module/__init__.py-style uisetup called -ui.parentui is None +ui.parentui isnot None reposetup called for a ui == repo.ui Foo