cmdserver: take repo.baseui as our ui
The ui passed to server() is really repo.ui, that is it contains its local
configuration as well.
When running commands that use a different repo than the servers cached repo,
we don't want to use that ui as the baseui for the new repo.
--- a/mercurial/commandserver.py Fri Jul 15 10:18:24 2011 +0200
+++ b/mercurial/commandserver.py Thu Jul 14 11:46:15 2011 +0300
@@ -132,7 +132,6 @@
"""
def __init__(self, ui, repo, mode):
self.cwd = os.getcwd()
- self.ui = ui
logpath = ui.config("cmdserver", "log", None)
if logpath:
@@ -143,6 +142,9 @@
else:
logfile = open(logpath, 'a')
+ # the ui here is really the repo ui so take its baseui so we don't end up
+ # with its local configuration
+ self.ui = repo.baseui
self.repo = repo
self.repoui = repo.ui
--- a/tests/test-commandserver.py Fri Jul 15 10:18:24 2011 +0200
+++ b/tests/test-commandserver.py Thu Jul 14 11:46:15 2011 +0300
@@ -1,4 +1,4 @@
-import sys, os, struct, subprocess, cStringIO, re
+import sys, os, struct, subprocess, cStringIO, re, shutil
def connect(path=None):
cmdline = ['hg', 'serve', '--cmdserver', 'pipe']
@@ -131,6 +131,19 @@
runcommand(server, ['st', 'foo/bar'])
os.remove('foo/bar')
+def localhgrc(server):
+ """ check that local configs for the cached repo aren't inherited when -R
+ is used """
+ readchannel(server)
+
+ # the cached repo local hgrc contains ui.foo=bar, so showconfig should show it
+ runcommand(server, ['showconfig'])
+
+ # but not for this repo
+ runcommand(server, ['init', 'foo'])
+ runcommand(server, ['-R', 'foo', 'showconfig'])
+ shutil.rmtree('foo')
+
if __name__ == '__main__':
os.system('hg init')
@@ -140,3 +153,8 @@
check(inputeof)
check(serverinput)
check(cwd)
+
+ hgrc = open('.hg/hgrc', 'a')
+ hgrc.write('[ui]\nfoo=bar\n')
+ hgrc.close()
+ check(localhgrc)
--- a/tests/test-commandserver.py.out Fri Jul 15 10:18:24 2011 +0200
+++ b/tests/test-commandserver.py.out Thu Jul 14 11:46:15 2011 +0300
@@ -38,3 +38,14 @@
? bar
? foo/bar
+bundle.mainreporoot=$TESTTMP
+defaults.backout=-d "0 0"
+defaults.commit=-d "0 0"
+defaults.tag=-d "0 0"
+ui.slash=True
+ui.foo=bar
+bundle.mainreporoot=$TESTTMP/foo
+defaults.backout=-d "0 0"
+defaults.commit=-d "0 0"
+defaults.tag=-d "0 0"
+ui.slash=True