mercurial/localrepo.py
changeset 39689 f19bba3f4d3f
parent 39688 2f9cdb5b3644
child 39690 e0c5017124b3
--- a/mercurial/localrepo.py	Wed Sep 12 11:31:14 2018 -0700
+++ b/mercurial/localrepo.py	Wed Sep 12 11:34:02 2018 -0700
@@ -376,7 +376,7 @@
 # set to reflect that the extension knows how to handle that requirements.
 featuresetupfuncs = set()
 
-def makelocalrepository(ui, path, intents=None):
+def makelocalrepository(baseui, path, intents=None):
     """Create a local repository object.
 
     Given arguments needed to construct a local repository, this function
@@ -386,6 +386,10 @@
     The returned object conforms to the ``repository.completelocalrepository``
     interface.
     """
+    ui = baseui.copy()
+    # Prevent copying repo configuration.
+    ui.copy = baseui.copy
+
     # Working directory VFS rooted at repository root.
     wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True)
 
@@ -394,7 +398,9 @@
     hgvfs = vfsmod.vfs(hgpath, cacheaudited=True)
 
     return localrepository(
-        ui, path,
+        baseui=baseui,
+        ui=ui,
+        origroot=path,
         wdirvfs=wdirvfs,
         hgvfs=hgvfs,
         intents=intents)
@@ -449,7 +455,7 @@
         'bisect.state',
     }
 
-    def __init__(self, baseui, origroot, wdirvfs, hgvfs, intents=None):
+    def __init__(self, baseui, ui, origroot, wdirvfs, hgvfs, intents=None):
         """Create a new local repository instance.
 
         Most callers should use ``hg.repository()``, ``localrepo.instance()``,
@@ -459,8 +465,10 @@
         Arguments:
 
         baseui
-           ``ui.ui`` instance to use. A copy will be made (since new config
-           options may be loaded into it).
+           ``ui.ui`` instance that ``ui`` argument was based off of.
+
+        ui
+           ``ui.ui`` instance for use by the repository.
 
         origroot
            ``bytes`` path to working directory root of this repository.
@@ -476,9 +484,7 @@
            for.
         """
         self.baseui = baseui
-        self.ui = baseui.copy()
-        self.ui.copy = baseui.copy  # prevent copying repo configuration
-
+        self.ui = ui
         self.origroot = origroot
         # vfs rooted at working directory.
         self.wvfs = wdirvfs