Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/chgserver.py @ 49004:f254fc73d956
global: bulk replace simple pycompat.iteritems(x) with x.items()
pycompat.iteritems() just calls .items().
This commit applies a regular expression search and replace to convert
simple instances of pycompat.iteritems() with .items(). There are still
a handful of calls to pycompat.iteritems() remaining. But these all have
more complicated expressions that I wasn't comfortable performing an
automated replace on. In addition, some simple replacements were withheld
because they broke pytype. These will be handled by their own changesets.
Differential Revision: https://phab.mercurial-scm.org/D12318
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 03 Mar 2022 18:28:30 -0800 |
parents | 0bb28b7736bc |
children | 642e31cb55f0 |
comparison
equal
deleted
inserted
replaced
49003:a0674e916fb6 | 49004:f254fc73d956 |
---|---|
132 ignored = {b'HG'} | 132 ignored = {b'HG'} |
133 else: | 133 else: |
134 ignored = set() | 134 ignored = set() |
135 envitems = [ | 135 envitems = [ |
136 (k, v) | 136 (k, v) |
137 for k, v in pycompat.iteritems(encoding.environ) | 137 for k, v in encoding.environ.items() |
138 if _envre.match(k) and k not in ignored | 138 if _envre.match(k) and k not in ignored |
139 ] | 139 ] |
140 envhash = _hashlist(sorted(envitems)) | 140 envhash = _hashlist(sorted(envitems)) |
141 return sectionhash[:6] + envhash[:6] | 141 return sectionhash[:6] + envhash[:6] |
142 | 142 |
318 self.out = out | 318 self.out = out |
319 self.channel = channel | 319 self.channel = channel |
320 | 320 |
321 def __call__(self, cmd, environ, cwd=None, type=b'system', cmdtable=None): | 321 def __call__(self, cmd, environ, cwd=None, type=b'system', cmdtable=None): |
322 args = [type, cmd, util.abspath(cwd or b'.')] | 322 args = [type, cmd, util.abspath(cwd or b'.')] |
323 args.extend(b'%s=%s' % (k, v) for k, v in pycompat.iteritems(environ)) | 323 args.extend(b'%s=%s' % (k, v) for k, v in environ.items()) |
324 data = b'\0'.join(args) | 324 data = b'\0'.join(args) |
325 self.out.write(struct.pack(b'>cI', self.channel, len(data))) | 325 self.out.write(struct.pack(b'>cI', self.channel, len(data))) |
326 self.out.write(data) | 326 self.out.write(data) |
327 self.out.flush() | 327 self.out.flush() |
328 | 328 |