##// END OF EJS Templates
ui: remove _write() and _write_err() functions
Yuya Nishihara -
r40576:06e841e7 default
parent child Browse files
Show More
@@ -951,12 +951,6 b' class ui(object):'
951
951
952 def _writenobuf(self, dest, *args, **opts):
952 def _writenobuf(self, dest, *args, **opts):
953 self._progclear()
953 self._progclear()
954 if dest is self.fout:
955 write = self._write
956 elif dest is self.ferr:
957 write = self._write_err
958 else:
959 raise error.ProgrammingError('unsupported file to write')
960 msg = b''.join(args)
954 msg = b''.join(args)
961
955
962 # opencode timeblockedsection because this is a critical path
956 # opencode timeblockedsection because this is a critical path
@@ -967,12 +961,12 b' class ui(object):'
967 if self._colormode == 'win32':
961 if self._colormode == 'win32':
968 # windows color printing is its own can of crab, defer to
962 # windows color printing is its own can of crab, defer to
969 # the color module and that is it.
963 # the color module and that is it.
970 color.win32print(self, write, msg, **opts)
964 color.win32print(self, dest.write, msg, **opts)
971 else:
965 else:
972 if self._colormode is not None:
966 if self._colormode is not None:
973 label = opts.get(r'label', '')
967 label = opts.get(r'label', '')
974 msg = self.label(msg, label)
968 msg = self.label(msg, label)
975 write(msg)
969 dest.write(msg)
976 # stderr may be buffered under win32 when redirected to files,
970 # stderr may be buffered under win32 when redirected to files,
977 # including stdout.
971 # including stdout.
978 if dest is self.ferr and not getattr(self.ferr, 'closed', False):
972 if dest is self.ferr and not getattr(self.ferr, 'closed', False):
@@ -987,18 +981,12 b' class ui(object):'
987 self._blockedtimes['stdio_blocked'] += \
981 self._blockedtimes['stdio_blocked'] += \
988 (util.timer() - starttime) * 1000
982 (util.timer() - starttime) * 1000
989
983
990 def _write(self, data):
991 self.fout.write(data)
992
993 def write_err(self, *args, **opts):
984 def write_err(self, *args, **opts):
994 if self._bufferstates and self._bufferstates[-1][0]:
985 if self._bufferstates and self._bufferstates[-1][0]:
995 self.write(*args, **opts)
986 self.write(*args, **opts)
996 else:
987 else:
997 self._writenobuf(self.ferr, *args, **opts)
988 self._writenobuf(self.ferr, *args, **opts)
998
989
999 def _write_err(self, data):
1000 self.ferr.write(data)
1001
1002 def flush(self):
990 def flush(self):
1003 # opencode timeblockedsection because this is a critical path
991 # opencode timeblockedsection because this is a critical path
1004 starttime = util.timer()
992 starttime = util.timer()
General Comments 0
You need to be logged in to leave comments. Login now