##// END OF EJS Templates
chgserver: make _renewui load repo and command line configs...
Jun Wu -
r28264:3682e201 default
parent child Browse files
Show More
@@ -180,17 +180,35 b' def _newchgui(srcui, csystem):'
180
180
181 return chgui(srcui)
181 return chgui(srcui)
182
182
183 def _renewui(srcui):
183 def _renewui(srcui, args=None):
184 if not args:
185 args = []
186
184 newui = srcui.__class__()
187 newui = srcui.__class__()
185 for a in ['fin', 'fout', 'ferr', 'environ']:
188 for a in ['fin', 'fout', 'ferr', 'environ']:
186 setattr(newui, a, getattr(srcui, a))
189 setattr(newui, a, getattr(srcui, a))
187 if util.safehasattr(srcui, '_csystem'):
190 if util.safehasattr(srcui, '_csystem'):
188 newui._csystem = srcui._csystem
191 newui._csystem = srcui._csystem
192
193 # load wd and repo config, copied from dispatch.py
194 cwds = dispatch._earlygetopt(['--cwd'], args)
195 cwd = cwds and os.path.realpath(cwds[-1]) or None
196 rpath = dispatch._earlygetopt(["-R", "--repository", "--repo"], args)
197 path, newui = dispatch._getlocal(newui, rpath, wd=cwd)
198
199 # internal config: extensions.chgserver
200 # copy it. it can only be overrided from command line.
201 newui.setconfig('extensions', 'chgserver',
202 srcui.config('extensions', 'chgserver'), '--config')
203
204 # command line args
205 dispatch._parseconfig(newui, dispatch._earlygetopt(['--config'], args))
206
189 # stolen from tortoisehg.util.copydynamicconfig()
207 # stolen from tortoisehg.util.copydynamicconfig()
190 for section, name, value in srcui.walkconfig():
208 for section, name, value in srcui.walkconfig():
191 source = srcui.configsource(section, name)
209 source = srcui.configsource(section, name)
192 if ':' in source:
210 if ':' in source or source == '--config':
193 # path:line
211 # path:line or command line
194 continue
212 continue
195 if source == 'none':
213 if source == 'none':
196 # ui.configsource returns 'none' by default
214 # ui.configsource returns 'none' by default
General Comments 0
You need to be logged in to leave comments. Login now