# HG changeset patch # User Simon Heimberg # Date 2013-11-11 21:59:26 # Node ID b04cc8651a6354271e5bd17f936cea5151b4121f # Parent 93f9d11603d89fe9359cb0fae21d49515f011cd0 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. diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -184,7 +184,10 @@ class server(object): # 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() diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -171,6 +171,7 @@ class localrepository(object): 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