comparison mercurial/commandserver.py @ 14750:f5f97a0f983f stable

cmdserver: copy repo.ui before running commands
author Idan Kamara <idankk86@gmail.com>
date Fri, 24 Jun 2011 19:43:59 +0300
parents 350dcd481410
children 712954a67be3
comparison
equal deleted inserted replaced
14749:e3be7dc9a5e1 14750:f5f97a0f983f
141 logfile = channeledoutput(sys.stdout, sys.stdout, 'd') 141 logfile = channeledoutput(sys.stdout, sys.stdout, 'd')
142 else: 142 else:
143 logfile = open(logpath, 'a') 143 logfile = open(logpath, 'a')
144 144
145 self.repo = repo 145 self.repo = repo
146 self.repoui = repo.ui
146 147
147 if mode == 'pipe': 148 if mode == 'pipe':
148 self.cerr = channeledoutput(sys.stderr, sys.stdout, 'e') 149 self.cerr = channeledoutput(sys.stderr, sys.stdout, 'e')
149 self.cout = channeledoutput(sys.stdout, sys.stdout, 'o') 150 self.cout = channeledoutput(sys.stdout, sys.stdout, 'o')
150 self.cin = channeledinput(sys.stdin, sys.stdout, 'I') 151 self.cin = channeledinput(sys.stdin, sys.stdout, 'I')
174 if not length: 175 if not length:
175 args = [] 176 args = []
176 else: 177 else:
177 args = self._read(length).split('\0') 178 args = self._read(length).split('\0')
178 179
179 # copy the ui so changes to it don't persist between requests 180 # copy the uis so changes (e.g. --config or --verbose) don't
181 # persist between requests
182 self.repo.ui = self.repo.dirstate._ui = self.repoui.copy()
180 req = dispatch.request(args, self.ui.copy(), self.repo, self.cin, 183 req = dispatch.request(args, self.ui.copy(), self.repo, self.cin,
181 self.cout, self.cerr) 184 self.cout, self.cerr)
182 185
183 ret = dispatch.dispatch(req) or 0 # might return None 186 ret = dispatch.dispatch(req) or 0 # might return None
184 187