Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/chgserver.py @ 41833:bce2356ece68
py3: port things from chgserver.py
I have installed mercurial on my personal laptop using Python 3.7. I also have
hg aliased to chg. Before this commit, `hg version` didn't work. After this
patch, things are better and now chg works.
Differential Revision: https://phab.mercurial-scm.org/D6040
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Sat, 02 Mar 2019 05:12:45 +0530 |
parents | 78027e7bc544 |
children | 49998d5ba66a |
comparison
equal
deleted
inserted
replaced
41832:faa04f45b5fe | 41833:bce2356ece68 |
---|---|
62 util, | 62 util, |
63 ) | 63 ) |
64 | 64 |
65 from .utils import ( | 65 from .utils import ( |
66 procutil, | 66 procutil, |
67 stringutil, | |
67 ) | 68 ) |
68 | 69 |
69 def _hashlist(items): | 70 def _hashlist(items): |
70 """return sha1 hexdigest for a list""" | 71 """return sha1 hexdigest for a list""" |
71 return node.hex(hashlib.sha1(str(items)).digest()) | 72 return node.hex(hashlib.sha1(stringutil.pprint(items)).digest()) |
72 | 73 |
73 # sensitive config sections affecting confighash | 74 # sensitive config sections affecting confighash |
74 _configsections = [ | 75 _configsections = [ |
75 'alias', # affects global state commands.table | 76 'alias', # affects global state commands.table |
76 'eol', # uses setconfig('eol', ...) | 77 'eol', # uses setconfig('eol', ...) |
81 _configsectionitems = [ | 82 _configsectionitems = [ |
82 ('commands', 'show.aliasprefix'), # show.py reads it in extsetup | 83 ('commands', 'show.aliasprefix'), # show.py reads it in extsetup |
83 ] | 84 ] |
84 | 85 |
85 # sensitive environment variables affecting confighash | 86 # sensitive environment variables affecting confighash |
86 _envre = re.compile(r'''\A(?: | 87 _envre = re.compile(br'''\A(?: |
87 CHGHG | 88 CHGHG |
88 |HG(?:DEMANDIMPORT|EMITWARNINGS|MODULEPOLICY|PROF|RCPATH)? | 89 |HG(?:DEMANDIMPORT|EMITWARNINGS|MODULEPOLICY|PROF|RCPATH)? |
89 |HG(?:ENCODING|PLAIN).* | 90 |HG(?:ENCODING|PLAIN).* |
90 |LANG(?:UAGE)? | 91 |LANG(?:UAGE)? |
91 |LC_.* | 92 |LC_.* |
447 if self.hashstate.mtimehash: | 448 if self.hashstate.mtimehash: |
448 insts.append('reconnect') | 449 insts.append('reconnect') |
449 if newhash.confighash != self.hashstate.confighash: | 450 if newhash.confighash != self.hashstate.confighash: |
450 addr = _hashaddress(self.baseaddress, newhash.confighash) | 451 addr = _hashaddress(self.baseaddress, newhash.confighash) |
451 insts.append('redirect %s' % addr) | 452 insts.append('redirect %s' % addr) |
452 self.ui.log('chgserver', 'validate: %s\n', insts) | 453 self.ui.log('chgserver', 'validate: %s\n', stringutil.pprint(insts)) |
453 self.cresult.write('\0'.join(insts) or '\0') | 454 self.cresult.write('\0'.join(insts) or '\0') |
454 | 455 |
455 def chdir(self): | 456 def chdir(self): |
456 """Change current directory | 457 """Change current directory |
457 | 458 |