comparison mercurial/ui.py @ 31177:a7cabac20b62

ui: fix opts labeling on ui.warn et al for Python 3 This is a step towards fixing extension load warnings on Python 3. Note that I suspect there are still some bugs in this area and that things like color won't work, but the code at least executes and prints text to the console correctly now.
author Augie Fackler <raf@durin42.com>
date Fri, 03 Mar 2017 14:08:24 -0500
parents e5aab82edf7f
children 81e289ef9376
comparison
equal deleted inserted replaced
31176:99c5843b228d 31177:a7cabac20b62
1211 '''write status message to output (if ui.quiet is False) 1211 '''write status message to output (if ui.quiet is False)
1212 1212
1213 This adds an output label of "ui.status". 1213 This adds an output label of "ui.status".
1214 ''' 1214 '''
1215 if not self.quiet: 1215 if not self.quiet:
1216 opts['label'] = opts.get('label', '') + ' ui.status' 1216 opts[r'label'] = opts.get(r'label', '') + ' ui.status'
1217 self.write(*msg, **opts) 1217 self.write(*msg, **opts)
1218 def warn(self, *msg, **opts): 1218 def warn(self, *msg, **opts):
1219 '''write warning message to output (stderr) 1219 '''write warning message to output (stderr)
1220 1220
1221 This adds an output label of "ui.warning". 1221 This adds an output label of "ui.warning".
1222 ''' 1222 '''
1223 opts['label'] = opts.get('label', '') + ' ui.warning' 1223 opts[r'label'] = opts.get(r'label', '') + ' ui.warning'
1224 self.write_err(*msg, **opts) 1224 self.write_err(*msg, **opts)
1225 def note(self, *msg, **opts): 1225 def note(self, *msg, **opts):
1226 '''write note to output (if ui.verbose is True) 1226 '''write note to output (if ui.verbose is True)
1227 1227
1228 This adds an output label of "ui.note". 1228 This adds an output label of "ui.note".
1229 ''' 1229 '''
1230 if self.verbose: 1230 if self.verbose:
1231 opts['label'] = opts.get('label', '') + ' ui.note' 1231 opts[r'label'] = opts.get(r'label', '') + ' ui.note'
1232 self.write(*msg, **opts) 1232 self.write(*msg, **opts)
1233 def debug(self, *msg, **opts): 1233 def debug(self, *msg, **opts):
1234 '''write debug message to output (if ui.debugflag is True) 1234 '''write debug message to output (if ui.debugflag is True)
1235 1235
1236 This adds an output label of "ui.debug". 1236 This adds an output label of "ui.debug".
1237 ''' 1237 '''
1238 if self.debugflag: 1238 if self.debugflag:
1239 opts['label'] = opts.get('label', '') + ' ui.debug' 1239 opts[r'label'] = opts.get(r'label', '') + ' ui.debug'
1240 self.write(*msg, **opts) 1240 self.write(*msg, **opts)
1241 1241
1242 def edit(self, text, user, extra=None, editform=None, pending=None, 1242 def edit(self, text, user, extra=None, editform=None, pending=None,
1243 repopath=None): 1243 repopath=None):
1244 extra_defaults = { 1244 extra_defaults = {