Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG4e377c43e80b: py3: handle keyword arguments correctly in ui.py
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
This should be a string containing label names separated by space. | This should be a string containing label names separated by space. | ||||
Label names take the form of "topic.type". For example, ui.debug() | Label names take the form of "topic.type". For example, ui.debug() | ||||
issues a label of "ui.debug". | issues a label of "ui.debug". | ||||
When labeling output for a specific command, a label of | When labeling output for a specific command, a label of | ||||
"cmdname.type" is recommended. For example, status issues | "cmdname.type" is recommended. For example, status issues | ||||
a label of "status.modified" for modified files. | a label of "status.modified" for modified files. | ||||
''' | ''' | ||||
if self._buffers and not opts.get('prompt', False): | if self._buffers and not opts.get(r'prompt', False): | ||||
if self._bufferapplylabels: | if self._bufferapplylabels: | ||||
label = opts.get('label', '') | label = opts.get(r'label', '') | ||||
self._buffers[-1].extend(self.label(a, label) for a in args) | self._buffers[-1].extend(self.label(a, label) for a in args) | ||||
else: | else: | ||||
self._buffers[-1].extend(args) | self._buffers[-1].extend(args) | ||||
elif self._colormode == 'win32': | elif self._colormode == 'win32': | ||||
# windows color printing is its own can of crab, defer to | # windows color printing is its own can of crab, defer to | ||||
# the color module and that is it. | # the color module and that is it. | ||||
color.win32print(self, self._write, *args, **opts) | color.win32print(self, self._write, *args, **opts) | ||||
else: | else: | ||||
msgs = args | msgs = args | ||||
if self._colormode is not None: | if self._colormode is not None: | ||||
label = opts.get('label', '') | label = opts.get(r'label', '') | ||||
msgs = [self.label(a, label) for a in args] | msgs = [self.label(a, label) for a in args] | ||||
self._write(*msgs, **opts) | self._write(*msgs, **opts) | ||||
def _write(self, *msgs, **opts): | def _write(self, *msgs, **opts): | ||||
self._progclear() | self._progclear() | ||||
# opencode timeblockedsection because this is a critical path | # opencode timeblockedsection because this is a critical path | ||||
starttime = util.timer() | starttime = util.timer() | ||||
try: | try: | ||||
self.write(*args, **opts) | self.write(*args, **opts) | ||||
elif self._colormode == 'win32': | elif self._colormode == 'win32': | ||||
# windows color printing is its own can of crab, defer to | # windows color printing is its own can of crab, defer to | ||||
# the color module and that is it. | # the color module and that is it. | ||||
color.win32print(self, self._write_err, *args, **opts) | color.win32print(self, self._write_err, *args, **opts) | ||||
else: | else: | ||||
msgs = args | msgs = args | ||||
if self._colormode is not None: | if self._colormode is not None: | ||||
label = opts.get('label', '') | label = opts.get(r'label', '') | ||||
msgs = [self.label(a, label) for a in args] | msgs = [self.label(a, label) for a in args] | ||||
self._write_err(*msgs, **opts) | self._write_err(*msgs, **opts) | ||||
def _write_err(self, *msgs, **opts): | def _write_err(self, *msgs, **opts): | ||||
try: | try: | ||||
with self.timeblockedsection('stdio'): | with self.timeblockedsection('stdio'): | ||||
if not getattr(self.fout, 'closed', False): | if not getattr(self.fout, 'closed', False): | ||||
self.fout.flush() | self.fout.flush() |