Patchwork [2,of,6,py3] ui: fix opts labeling on ui.warn et al for Python 3

login
register
mail settings
Submitter Augie Fackler
Date March 6, 2017, 11:23 p.m.
Message ID <2e19b1921f0ba7f3550c.1488842586@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/18946/
State Accepted
Headers show

Comments

Augie Fackler - March 6, 2017, 11:23 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1488568104 18000
#      Fri Mar 03 14:08:24 2017 -0500
# Node ID 2e19b1921f0ba7f3550c11f7f3c85e88e732e3a0
# Parent  428615d799a9115249f3aab8d6481e384e879f6a
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.

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1213,14 +1213,14 @@  class ui(object):
         This adds an output label of "ui.status".
         '''
         if not self.quiet:
-            opts['label'] = opts.get('label', '') + ' ui.status'
+            opts[r'label'] = opts.get(r'label', '') + ' ui.status'
             self.write(*msg, **opts)
     def warn(self, *msg, **opts):
         '''write warning message to output (stderr)
 
         This adds an output label of "ui.warning".
         '''
-        opts['label'] = opts.get('label', '') + ' ui.warning'
+        opts[r'label'] = opts.get(r'label', '') + ' ui.warning'
         self.write_err(*msg, **opts)
     def note(self, *msg, **opts):
         '''write note to output (if ui.verbose is True)
@@ -1228,7 +1228,7 @@  class ui(object):
         This adds an output label of "ui.note".
         '''
         if self.verbose:
-            opts['label'] = opts.get('label', '') + ' ui.note'
+            opts[r'label'] = opts.get(r'label', '') + ' ui.note'
             self.write(*msg, **opts)
     def debug(self, *msg, **opts):
         '''write debug message to output (if ui.debugflag is True)
@@ -1236,7 +1236,7 @@  class ui(object):
         This adds an output label of "ui.debug".
         '''
         if self.debugflag:
-            opts['label'] = opts.get('label', '') + ' ui.debug'
+            opts[r'label'] = opts.get(r'label', '') + ' ui.debug'
             self.write(*msg, **opts)
 
     def edit(self, text, user, extra=None, editform=None, pending=None,