Mercurial > public > mercurial-scm > hg
comparison tests/test-commandserver.py @ 14882:bb2cffe81a94 stable
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.
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Thu, 14 Jul 2011 11:46:15 +0300 |
parents | 5233df79deed |
children | a59058fd074a |
comparison
equal
deleted
inserted
replaced
14881:2e54387976d4 | 14882:bb2cffe81a94 |
---|---|
1 import sys, os, struct, subprocess, cStringIO, re | 1 import sys, os, struct, subprocess, cStringIO, re, shutil |
2 | 2 |
3 def connect(path=None): | 3 def connect(path=None): |
4 cmdline = ['hg', 'serve', '--cmdserver', 'pipe'] | 4 cmdline = ['hg', 'serve', '--cmdserver', 'pipe'] |
5 if path: | 5 if path: |
6 cmdline += ['-R', path] | 6 cmdline += ['-R', path] |
129 f.close() | 129 f.close() |
130 runcommand(server, ['--cwd', 'foo', 'st', 'bar']) | 130 runcommand(server, ['--cwd', 'foo', 'st', 'bar']) |
131 runcommand(server, ['st', 'foo/bar']) | 131 runcommand(server, ['st', 'foo/bar']) |
132 os.remove('foo/bar') | 132 os.remove('foo/bar') |
133 | 133 |
134 def localhgrc(server): | |
135 """ check that local configs for the cached repo aren't inherited when -R | |
136 is used """ | |
137 readchannel(server) | |
138 | |
139 # the cached repo local hgrc contains ui.foo=bar, so showconfig should show it | |
140 runcommand(server, ['showconfig']) | |
141 | |
142 # but not for this repo | |
143 runcommand(server, ['init', 'foo']) | |
144 runcommand(server, ['-R', 'foo', 'showconfig']) | |
145 shutil.rmtree('foo') | |
146 | |
134 if __name__ == '__main__': | 147 if __name__ == '__main__': |
135 os.system('hg init') | 148 os.system('hg init') |
136 | 149 |
137 check(hellomessage) | 150 check(hellomessage) |
138 check(unknowncommand) | 151 check(unknowncommand) |
139 check(checkruncommand) | 152 check(checkruncommand) |
140 check(inputeof) | 153 check(inputeof) |
141 check(serverinput) | 154 check(serverinput) |
142 check(cwd) | 155 check(cwd) |
156 | |
157 hgrc = open('.hg/hgrc', 'a') | |
158 hgrc.write('[ui]\nfoo=bar\n') | |
159 hgrc.close() | |
160 check(localhgrc) |