diff 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
line wrap: on
line diff
--- a/mercurial/ui.py	Tue Feb 06 05:25:36 2018 -0500
+++ b/mercurial/ui.py	Sun Feb 04 00:29:22 2018 +0100
@@ -870,6 +870,17 @@
 
         return "".join(self._buffers.pop())
 
+    def canwritewithoutlabels(self):
+        '''check if write skips the label'''
+        if self._buffers and not self._bufferapplylabels:
+            return True
+        return self._colormode is None
+
+    def canbatchlabeledwrites(self):
+        '''check if write calls with labels are batchable'''
+        # Windows color printing is special, see ``write``.
+        return self._colormode != 'win32'
+
     def write(self, *args, **opts):
         '''write args to output