Patchwork [v2] registrar: make format strings unicodes and not bytes

login
register
mail settings
Submitter Augie Fackler
Date Oct. 7, 2016, 3:07 p.m.
Message ID <156a151866dd338a2e96.1475852867@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/16894/
State Accepted
Headers show

Comments

Augie Fackler - Oct. 7, 2016, 3:07 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1475843538 14400
#      Fri Oct 07 08:32:18 2016 -0400
# Node ID 156a151866dd338a2e9625d52724ef110e417cdd
# Parent  8b89521a69ba3b65f40f141b810bb7449ae7fcf0
registrar: make format strings unicodes and not bytes

Fixes issues on Python 3, wherein docstrings are unicodes. Shouldn't
break anything on Python 2.

Patch

diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -8,6 +8,7 @@ 
 from __future__ import absolute_import
 
 from . import (
+    pycompat,
     util,
 )
 
@@ -121,7 +122,7 @@  class revsetpredicate(_funcregistrarbase
     Otherwise, explicit 'revset.loadpredicate()' is needed.
     """
     _getname = _funcregistrarbase._parsefuncdecl
-    _docformat = "``%s``\n    %s"
+    _docformat = pycompat.sysstr("``%s``\n    %s")
 
     def _extrasetup(self, name, func, safe=False, takeorder=False):
         func._safe = safe
@@ -160,7 +161,7 @@  class filesetpredicate(_funcregistrarbas
     Otherwise, explicit 'fileset.loadpredicate()' is needed.
     """
     _getname = _funcregistrarbase._parsefuncdecl
-    _docformat = "``%s``\n    %s"
+    _docformat = pycompat.sysstr("``%s``\n    %s")
 
     def _extrasetup(self, name, func, callstatus=False, callexisting=False):
         func._callstatus = callstatus
@@ -169,7 +170,7 @@  class filesetpredicate(_funcregistrarbas
 class _templateregistrarbase(_funcregistrarbase):
     """Base of decorator to register functions as template specific one
     """
-    _docformat = ":%s: %s"
+    _docformat = pycompat.sysstr(":%s: %s")
 
 class templatekeyword(_templateregistrarbase):
     """Decorator to register template keyword