##// END OF EJS Templates
ui: factor out function that writes data to fout/ferr with labeling...
Yuya Nishihara -
r40555:fd60c2af default
parent child Browse files
Show More
@@ -947,20 +947,20 b' class ui(object):'
947 947 else:
948 948 self._buffers[-1].extend(args)
949 949 else:
950 self._writenobuf(*args, **opts)
950 self._writenobuf(self._write, *args, **opts)
951 951
952 def _writenobuf(self, *args, **opts):
952 def _writenobuf(self, write, *args, **opts):
953 953 self._progclear()
954 954 if self._colormode == 'win32':
955 955 # windows color printing is its own can of crab, defer to
956 956 # the color module and that is it.
957 color.win32print(self, self._write, *args, **opts)
957 color.win32print(self, write, *args, **opts)
958 958 else:
959 959 msgs = args
960 960 if self._colormode is not None:
961 961 label = opts.get(r'label', '')
962 962 msgs = [self.label(a, label) for a in args]
963 self._write(*msgs, **opts)
963 write(*msgs, **opts)
964 964
965 965 def _write(self, *msgs, **opts):
966 966 # opencode timeblockedsection because this is a critical path
@@ -976,18 +976,8 b' class ui(object):'
976 976 def write_err(self, *args, **opts):
977 977 if self._bufferstates and self._bufferstates[-1][0]:
978 978 self.write(*args, **opts)
979 return
980 self._progclear()
981 if self._colormode == 'win32':
982 # windows color printing is its own can of crab, defer to
983 # the color module and that is it.
984 color.win32print(self, self._write_err, *args, **opts)
985 979 else:
986 msgs = args
987 if self._colormode is not None:
988 label = opts.get(r'label', '')
989 msgs = [self.label(a, label) for a in args]
990 self._write_err(*msgs, **opts)
980 self._writenobuf(self._write_err, *args, **opts)
991 981
992 982 def _write_err(self, *msgs, **opts):
993 983 try:
@@ -1352,7 +1342,7 b' class ui(object):'
1352 1342 if not self.interactive():
1353 1343 self.write(msg, ' ', default or '', "\n")
1354 1344 return default
1355 self._writenobuf(msg, label='ui.prompt')
1345 self._writenobuf(self._write, msg, label='ui.prompt')
1356 1346 self.flush()
1357 1347 try:
1358 1348 r = self._readline()
General Comments 0
You need to be logged in to leave comments. Login now