# HG changeset patch # User Gregory Szorc # Date 1536777242 25200 # Node ID f19bba3f4d3fab2167bfab9fac36ce645957af74 # Parent 2f9cdb5b364434435afd5b56b920124b1543b7d9 localrepo: copy ui in makelocalrepository() We will want to load the .hg/hgrc file from makelocalrepository() so we can consult its options as part of deriving the repository type. This means we need to create our ui instance copy in that function. Differential Revision: https://phab.mercurial-scm.org/D4565 diff -r 2f9cdb5b3644 -r f19bba3f4d3f mercurial/localrepo.py --- 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