Show More
@@ -71,6 +71,7 from mercurial import ( | |||||
71 | cmdutil, |
|
71 | cmdutil, | |
72 | commands, |
|
72 | commands, | |
73 | dispatch, |
|
73 | dispatch, | |
|
74 | encoding, | |||
74 | extensions, |
|
75 | extensions, | |
75 | util, |
|
76 | util, | |
76 | ) |
|
77 | ) | |
@@ -123,7 +124,7 def uisetup(ui): | |||||
123 | return |
|
124 | return | |
124 |
|
125 | |||
125 | def pagecmd(orig, ui, options, cmd, cmdfunc): |
|
126 | def pagecmd(orig, ui, options, cmd, cmdfunc): | |
126 |
p = ui.config("pager", "pager", |
|
127 | p = ui.config("pager", "pager", encoding.environ.get("PAGER")) | |
127 | usepager = False |
|
128 | usepager = False | |
128 | always = util.parsebool(options['pager']) |
|
129 | always = util.parsebool(options['pager']) | |
129 | auto = options['pager'] == 'auto' |
|
130 | auto = options['pager'] == 'auto' |
@@ -75,6 +75,7 from mercurial.i18n import _ | |||||
75 | from mercurial import ( |
|
75 | from mercurial import ( | |
76 | cmdutil, |
|
76 | cmdutil, | |
77 | commands, |
|
77 | commands, | |
|
78 | encoding, | |||
78 | error, |
|
79 | error, | |
79 | hg, |
|
80 | hg, | |
80 | mail, |
|
81 | mail, | |
@@ -693,8 +694,8 def email(ui, repo, *revs, **opts): | |||||
693 | if opts.get('test'): |
|
694 | if opts.get('test'): | |
694 | ui.status(_('displaying '), subj, ' ...\n') |
|
695 | ui.status(_('displaying '), subj, ' ...\n') | |
695 | ui.flush() |
|
696 | ui.flush() | |
696 |
if 'PAGER' in |
|
697 | if 'PAGER' in encoding.environ and not ui.plain(): | |
697 |
fp = util.popen( |
|
698 | fp = util.popen(encoding.environ['PAGER'], 'w') | |
698 | else: |
|
699 | else: | |
699 | fp = ui |
|
700 | fp = ui | |
700 | generator = emailmod.Generator.Generator(fp, mangle_from_=False) |
|
701 | generator = emailmod.Generator.Generator(fp, mangle_from_=False) |
@@ -55,6 +55,7 from .i18n import _ | |||||
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, | |
@@ -102,7 +103,8 def _confighash(ui): | |||||
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 |
|
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 | |||
@@ -177,7 +179,7 def _setuppagercmd(ui, options, cmd): | |||||
177 | if not ui.formatted(): |
|
179 | if not ui.formatted(): | |
178 | return |
|
180 | return | |
179 |
|
181 | |||
180 |
p = ui.config("pager", "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' | |
@@ -237,7 +239,7 def _newchgui(srcui, csystem): | |||||
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 = |
|
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() | |
@@ -512,8 +514,8 class chgcmdserver(commandserver.server) | |||||
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 |
|
|
517 | encoding.environ.clear() | |
516 |
|
|
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, | |
@@ -628,8 +630,8 class chgunixservicehandler(object): | |||||
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 |
|
633 | if 'CHGINTERNALMARK' in encoding.environ: | |
632 |
del |
|
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 |
@@ -8,11 +8,11 | |||||
8 |
|
8 | |||
9 | from __future__ import absolute_import |
|
9 | from __future__ import absolute_import | |
10 |
|
10 | |||
11 | import os |
|
|||
12 | import sys |
|
11 | import sys | |
13 |
|
12 | |||
14 | from .i18n import _ |
|
13 | from .i18n import _ | |
15 | from . import ( |
|
14 | from . import ( | |
|
15 | encoding, | |||
16 | error, |
|
16 | error, | |
17 | hook, |
|
17 | hook, | |
18 | util, |
|
18 | util, | |
@@ -131,5 +131,5 class sshserver(wireproto.abstractserver | |||||
131 | return cmd != '' |
|
131 | return cmd != '' | |
132 |
|
132 | |||
133 | def _client(self): |
|
133 | def _client(self): | |
134 |
client = |
|
134 | client = encoding.environ.get('SSH_CLIENT', '').split(' ', 1)[0] | |
135 | return 'remote:ssh:' + client |
|
135 | return 'remote:ssh:' + client |
@@ -24,6 +24,7 from .i18n import _ | |||||
24 | from . import ( |
|
24 | from . import ( | |
25 | cmdutil, |
|
25 | cmdutil, | |
26 | config, |
|
26 | config, | |
|
27 | encoding, | |||
27 | error, |
|
28 | error, | |
28 | exchange, |
|
29 | exchange, | |
29 | filemerge, |
|
30 | filemerge, | |
@@ -1102,7 +1103,7 class svnsubrepo(abstractsubrepo): | |||||
1102 | path = self.wvfs.reljoin(self._ctx.repo().origroot, |
|
1103 | path = self.wvfs.reljoin(self._ctx.repo().origroot, | |
1103 | self._path, filename) |
|
1104 | self._path, filename) | |
1104 | cmd.append(path) |
|
1105 | cmd.append(path) | |
1105 |
env = dict( |
|
1106 | env = dict(encoding.environ) | |
1106 | # Avoid localized output, preserve current locale for everything else. |
|
1107 | # Avoid localized output, preserve current locale for everything else. | |
1107 | lc_all = env.get('LC_ALL') |
|
1108 | lc_all = env.get('LC_ALL') | |
1108 | if lc_all: |
|
1109 | if lc_all: | |
@@ -1398,7 +1399,7 class gitsubrepo(abstractsubrepo): | |||||
1398 | """ |
|
1399 | """ | |
1399 | self.ui.debug('%s: git %s\n' % (self._relpath, ' '.join(commands))) |
|
1400 | self.ui.debug('%s: git %s\n' % (self._relpath, ' '.join(commands))) | |
1400 | if env is None: |
|
1401 | if env is None: | |
1401 |
env = |
|
1402 | env = encoding.environ.copy() | |
1402 | # disable localization for Git output (issue5176) |
|
1403 | # disable localization for Git output (issue5176) | |
1403 | env['LC_ALL'] = 'C' |
|
1404 | env['LC_ALL'] = 'C' | |
1404 | # fix for Git CVE-2015-7545 |
|
1405 | # fix for Git CVE-2015-7545 | |
@@ -1633,7 +1634,7 class gitsubrepo(abstractsubrepo): | |||||
1633 | if self._gitmissing(): |
|
1634 | if self._gitmissing(): | |
1634 | raise error.Abort(_("subrepo %s is missing") % self._relpath) |
|
1635 | raise error.Abort(_("subrepo %s is missing") % self._relpath) | |
1635 | cmd = ['commit', '-a', '-m', text] |
|
1636 | cmd = ['commit', '-a', '-m', text] | |
1636 |
env = |
|
1637 | env = encoding.environ.copy() | |
1637 | if user: |
|
1638 | if user: | |
1638 | cmd += ['--author', user] |
|
1639 | cmd += ['--author', user] | |
1639 | if date: |
|
1640 | if date: |
@@ -14,6 +14,7 import sys | |||||
14 |
|
14 | |||
15 | from .i18n import _ |
|
15 | from .i18n import _ | |
16 | from . import ( |
|
16 | from . import ( | |
|
17 | encoding, | |||
17 | error, |
|
18 | error, | |
18 | scmutil, |
|
19 | scmutil, | |
19 | util, |
|
20 | util, | |
@@ -32,7 +33,7 def countcpus(): | |||||
32 |
|
33 | |||
33 | # windows |
|
34 | # windows | |
34 | try: |
|
35 | try: | |
35 |
n = int( |
|
36 | n = int(encoding.environ['NUMBER_OF_PROCESSORS']) | |
36 | if n > 0: |
|
37 | if n > 0: | |
37 | return n |
|
38 | return n | |
38 | except (KeyError, ValueError): |
|
39 | except (KeyError, ValueError): |
General Comments 0
You need to be logged in to leave comments.
Login now