diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -132,7 +132,6 @@ class server(object): """ 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 @@ class server(object): 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 diff --git a/tests/test-commandserver.py b/tests/test-commandserver.py --- a/tests/test-commandserver.py +++ b/tests/test-commandserver.py @@ -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 @@ def cwd(server): 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 @@ if __name__ == '__main__': check(inputeof) check(serverinput) check(cwd) + + hgrc = open('.hg/hgrc', 'a') + hgrc.write('[ui]\nfoo=bar\n') + hgrc.close() + check(localhgrc) diff --git a/tests/test-commandserver.py.out b/tests/test-commandserver.py.out --- a/tests/test-commandserver.py.out +++ b/tests/test-commandserver.py.out @@ -38,3 +38,14 @@ summary: 1 ? 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