changeset 4619:5fd7cc897542

encoding: pull fallbackencoding out of localrepo into early parsing
author Matt Mackall <mpm@selenic.com>
date Mon, 18 Jun 2007 13:24:34 -0500
parents 7c8f8b736365
children d97fd22a0ea9
files mercurial/cmdutil.py mercurial/localrepo.py tests/test-extension.out
diffstat 3 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Mon Jun 18 13:24:34 2007 -0500
+++ b/mercurial/cmdutil.py	Mon Jun 18 13:24:34 2007 -0500
@@ -261,20 +261,24 @@
     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)
 
--- a/mercurial/localrepo.py	Mon Jun 18 13:24:34 2007 -0500
+++ b/mercurial/localrepo.py	Mon Jun 18 13:24:34 2007 -0500
@@ -80,10 +80,6 @@
         except IOError:
             pass
 
-        fallback = self.ui.config('ui', 'fallbackencoding')
-        if fallback:
-            util._fallbackencoding = fallback
-
         self.tagscache = None
         self.branchcache = None
         self.nodetagscache = None
--- a/tests/test-extension.out	Mon Jun 18 13:24:34 2007 -0500
+++ b/tests/test-extension.out	Mon Jun 18 13:24:34 2007 -0500
@@ -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 @@
 Bar
 % module/__init__.py-style
 uisetup called
-ui.parentui is None
+ui.parentui isnot None
 reposetup called for a
 ui == repo.ui
 Foo