comparison mercurial/ui.py @ 35961:0ff41ced4c12

diff: improve ui.write performance when not coloring on Windows Differential Revision: https://phab.mercurial-scm.org/D2022
author Joerg Sonnenberger <joerg@bec.de>
date Sun, 04 Feb 2018 00:29:22 +0100
parents b62c4154bb28
children 8f5c7f906f9b
comparison
equal deleted inserted replaced
35960:580f7b1b88c7 35961:0ff41ced4c12
868 else: 868 else:
869 self._bufferapplylabels = None 869 self._bufferapplylabels = None
870 870
871 return "".join(self._buffers.pop()) 871 return "".join(self._buffers.pop())
872 872
873 def canwritewithoutlabels(self):
874 '''check if write skips the label'''
875 if self._buffers and not self._bufferapplylabels:
876 return True
877 return self._colormode is None
878
879 def canbatchlabeledwrites(self):
880 '''check if write calls with labels are batchable'''
881 # Windows color printing is special, see ``write``.
882 return self._colormode != 'win32'
883
873 def write(self, *args, **opts): 884 def write(self, *args, **opts):
874 '''write args to output 885 '''write args to output
875 886
876 By default, this method simply writes to the buffer or stdout. 887 By default, this method simply writes to the buffer or stdout.
877 Color mode can be set on the UI class to have the output decorated 888 Color mode can be set on the UI class to have the output decorated