Mercurial > hg
comparison mercurial/ui.py @ 40522:51091816a355
ui: simply concatenate messages before applying color labels
This should be cheaper in space than applying labels for each message.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 03 Nov 2018 17:42:05 +0900 |
parents | 49746e53ac92 |
children | 0c7b2035a604 |
comparison
equal
deleted
inserted
replaced
40521:49746e53ac92 | 40522:51091816a355 |
---|---|
949 else: | 949 else: |
950 self._writenobuf(self._write, *args, **opts) | 950 self._writenobuf(self._write, *args, **opts) |
951 | 951 |
952 def _writenobuf(self, write, *args, **opts): | 952 def _writenobuf(self, write, *args, **opts): |
953 self._progclear() | 953 self._progclear() |
954 msg = b''.join(args) | |
954 if self._colormode == 'win32': | 955 if self._colormode == 'win32': |
955 # windows color printing is its own can of crab, defer to | 956 # windows color printing is its own can of crab, defer to |
956 # the color module and that is it. | 957 # the color module and that is it. |
957 color.win32print(self, write, *args, **opts) | 958 color.win32print(self, write, msg, **opts) |
958 else: | 959 else: |
959 msgs = args | |
960 if self._colormode is not None: | 960 if self._colormode is not None: |
961 label = opts.get(r'label', '') | 961 label = opts.get(r'label', '') |
962 msgs = [self.label(a, label) for a in args] | 962 msg = self.label(msg, label) |
963 write(b''.join(msgs)) | 963 write(msg) |
964 | 964 |
965 def _write(self, data): | 965 def _write(self, data): |
966 # opencode timeblockedsection because this is a critical path | 966 # opencode timeblockedsection because this is a critical path |
967 starttime = util.timer() | 967 starttime = util.timer() |
968 try: | 968 try: |