Details
Details
- Reviewers
yuja - Group Reviewers
hg-reviewers - Commits
- rHGe218830f6f0a: convert: don't use bytes as a variable name
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
yuja |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/convert/common.py (8 lines) |
# Since ARG_MAX is for command line _and_ environment, lower our limit | # Since ARG_MAX is for command line _and_ environment, lower our limit | ||||
# (and make happy Windows shells while doing this). | # (and make happy Windows shells while doing this). | ||||
return argmax // 2 - 1 | return argmax // 2 - 1 | ||||
def _limit_arglist(self, arglist, cmd, *args, **kwargs): | def _limit_arglist(self, arglist, cmd, *args, **kwargs): | ||||
cmdlen = len(self._cmdline(cmd, *args, **kwargs)) | cmdlen = len(self._cmdline(cmd, *args, **kwargs)) | ||||
limit = self.argmax - cmdlen | limit = self.argmax - cmdlen | ||||
bytes = 0 | numbytes = 0 | ||||
fl = [] | fl = [] | ||||
for fn in arglist: | for fn in arglist: | ||||
b = len(fn) + 3 | b = len(fn) + 3 | ||||
if bytes + b < limit or len(fl) == 0: | if numbytes + b < limit or len(fl) == 0: | ||||
fl.append(fn) | fl.append(fn) | ||||
bytes += b | numbytes += b | ||||
else: | else: | ||||
yield fl | yield fl | ||||
fl = [fn] | fl = [fn] | ||||
bytes = b | numbytes = b | ||||
if fl: | if fl: | ||||
yield fl | yield fl | ||||
def xargs(self, arglist, cmd, *args, **kwargs): | def xargs(self, arglist, cmd, *args, **kwargs): | ||||
for l in self._limit_arglist(arglist, cmd, *args, **kwargs): | for l in self._limit_arglist(arglist, cmd, *args, **kwargs): | ||||
self.run0(cmd, *(list(args) + l), **kwargs) | self.run0(cmd, *(list(args) + l), **kwargs) | ||||
class mapfile(dict): | class mapfile(dict): |