equal
deleted
inserted
replaced
53 from .i18n import _ |
53 from .i18n import _ |
54 |
54 |
55 from . import ( |
55 from . import ( |
56 cmdutil, |
56 cmdutil, |
57 commandserver, |
57 commandserver, |
|
58 encoding, |
58 error, |
59 error, |
59 extensions, |
60 extensions, |
60 osutil, |
61 osutil, |
61 util, |
62 util, |
62 ) |
63 ) |
100 """ |
101 """ |
101 sectionitems = [] |
102 sectionitems = [] |
102 for section in _configsections: |
103 for section in _configsections: |
103 sectionitems.append(ui.configitems(section)) |
104 sectionitems.append(ui.configitems(section)) |
104 sectionhash = _hashlist(sectionitems) |
105 sectionhash = _hashlist(sectionitems) |
105 envitems = [(k, v) for k, v in os.environ.iteritems() if _envre.match(k)] |
106 envitems = [(k, v) for k, v in encoding.environ.iteritems() |
|
107 if _envre.match(k)] |
106 envhash = _hashlist(sorted(envitems)) |
108 envhash = _hashlist(sorted(envitems)) |
107 return sectionhash[:6] + envhash[:6] |
109 return sectionhash[:6] + envhash[:6] |
108 |
110 |
109 def _getmtimepaths(ui): |
111 def _getmtimepaths(ui): |
110 """get a list of paths that should be checked to detect change |
112 """get a list of paths that should be checked to detect change |
175 from . import commands # avoid cycle |
177 from . import commands # avoid cycle |
176 |
178 |
177 if not ui.formatted(): |
179 if not ui.formatted(): |
178 return |
180 return |
179 |
181 |
180 p = ui.config("pager", "pager", os.environ.get("PAGER")) |
182 p = ui.config("pager", "pager", encoding.environ.get("PAGER")) |
181 usepager = False |
183 usepager = False |
182 always = util.parsebool(options['pager']) |
184 always = util.parsebool(options['pager']) |
183 auto = options['pager'] == 'auto' |
185 auto = options['pager'] == 'auto' |
184 |
186 |
185 if not p: |
187 if not p: |
235 if val is None or val is False: |
237 if val is None or val is False: |
236 return '0' |
238 return '0' |
237 if val is True: |
239 if val is True: |
238 return '1' |
240 return '1' |
239 return str(val) |
241 return str(val) |
240 env = os.environ.copy() |
242 env = encoding.environ.copy() |
241 if environ: |
243 if environ: |
242 env.update((k, py2shell(v)) for k, v in environ.iteritems()) |
244 env.update((k, py2shell(v)) for k, v in environ.iteritems()) |
243 env['HG'] = util.hgexecutable() |
245 env['HG'] = util.hgexecutable() |
244 rc = self._csystem(cmd, env, cwd) |
246 rc = self._csystem(cmd, env, cwd) |
245 if rc and onerr: |
247 if rc and onerr: |
510 try: |
512 try: |
511 newenv = dict(s.split('=', 1) for s in l) |
513 newenv = dict(s.split('=', 1) for s in l) |
512 except ValueError: |
514 except ValueError: |
513 raise ValueError('unexpected value in setenv request') |
515 raise ValueError('unexpected value in setenv request') |
514 _log('setenv: %r\n' % sorted(newenv.keys())) |
516 _log('setenv: %r\n' % sorted(newenv.keys())) |
515 os.environ.clear() |
517 encoding.environ.clear() |
516 os.environ.update(newenv) |
518 encoding.environ.update(newenv) |
517 |
519 |
518 capabilities = commandserver.server.capabilities.copy() |
520 capabilities = commandserver.server.capabilities.copy() |
519 capabilities.update({'attachio': attachio, |
521 capabilities.update({'attachio': attachio, |
520 'chdir': chdir, |
522 'chdir': chdir, |
521 'getpager': getpager, |
523 'getpager': getpager, |
626 self._hashstate, self._baseaddress) |
628 self._hashstate, self._baseaddress) |
627 |
629 |
628 def chgunixservice(ui, repo, opts): |
630 def chgunixservice(ui, repo, opts): |
629 # CHGINTERNALMARK is temporarily set by chg client to detect if chg will |
631 # CHGINTERNALMARK is temporarily set by chg client to detect if chg will |
630 # start another chg. drop it to avoid possible side effects. |
632 # start another chg. drop it to avoid possible side effects. |
631 if 'CHGINTERNALMARK' in os.environ: |
633 if 'CHGINTERNALMARK' in encoding.environ: |
632 del os.environ['CHGINTERNALMARK'] |
634 del encoding.environ['CHGINTERNALMARK'] |
633 |
635 |
634 if repo: |
636 if repo: |
635 # one chgserver can serve multiple repos. drop repo information |
637 # one chgserver can serve multiple repos. drop repo information |
636 ui.setconfig('bundle', 'mainreporoot', '', 'repo') |
638 ui.setconfig('bundle', 'mainreporoot', '', 'repo') |
637 h = chgunixservicehandler(ui) |
639 h = chgunixservicehandler(ui) |