Mercurial > hg
changeset 20082:b04cc8651a63
localrepo: prevent to copy repo local config, copy baseui instead
Copying a repos local configuration to another repo is a bad idea because the
2nd repo gets the configuration of the first. Prevent this by really calling
repo.baseui.copy when repo.ui.copy is called.
This requires some changes in commandserver which needs to clone repo.ui for
rejecting temporary changes.
This patch has its roots back in the topic "repo isolation" around f0564402d059
and was suggested by mpm.
author | Simon Heimberg <simohe@besonet.ch> |
---|---|
date | Mon, 11 Nov 2013 22:59:26 +0100 |
parents | 93f9d11603d8 |
children | c69e5911888d |
files | mercurial/commandserver.py mercurial/localrepo.py |
diffstat | 2 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commandserver.py Fri Nov 08 14:42:09 2013 +0900 +++ b/mercurial/commandserver.py Mon Nov 11 22:59:26 2013 +0100 @@ -184,7 +184,10 @@ # persist between requests copiedui = self.ui.copy() self.repo.baseui = copiedui - self.repo.ui = self.repo.dirstate._ui = self.repoui.copy() + # clone ui without using ui.copy because this is protected + repoui = self.repoui.__class__(self.repoui) + repoui.copy = copiedui.copy # redo copy protection + self.repo.ui = self.repo.dirstate._ui = repoui self.repo.invalidate() self.repo.invalidatedirstate()
--- a/mercurial/localrepo.py Fri Nov 08 14:42:09 2013 +0900 +++ b/mercurial/localrepo.py Mon Nov 11 22:59:26 2013 +0100 @@ -171,6 +171,7 @@ self.opener = self.vfs self.baseui = baseui self.ui = baseui.copy() + self.ui.copy = baseui.copy # prevent copying repo configuration # A list of callback to shape the phase if no data were found. # Callback are in the form: func(repo, roots) --> processed root. # This list it to be filled by extension during repo setup