changeset 36088:c4fa47f880d3

py3: make sure we return str from __repr__ Differential Revision: https://phab.mercurial-scm.org/D2109
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 11 Feb 2018 16:17:17 +0530
parents 488e313954ea
children 035af48b2903
files mercurial/match.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/match.py	Sun Feb 11 14:30:44 2018 -0800
+++ b/mercurial/match.py	Sun Feb 11 16:17:17 2018 +0530
@@ -13,6 +13,7 @@
 
 from .i18n import _
 from . import (
+    encoding,
     error,
     pathutil,
     util,
@@ -345,7 +346,7 @@
         return 'all'
 
     def __repr__(self):
-        return '<alwaysmatcher>'
+        return r'<alwaysmatcher>'
 
 class nevermatcher(basematcher):
     '''Matches nothing.'''
@@ -368,7 +369,7 @@
         return False
 
     def __repr__(self):
-        return '<nevermatcher>'
+        return r'<nevermatcher>'
 
 class patternmatcher(basematcher):
 
@@ -397,6 +398,7 @@
     def prefix(self):
         return self._prefix
 
+    @encoding.strmethod
     def __repr__(self):
         return ('<patternmatcher patterns=%r>' % self._pats)
 
@@ -424,6 +426,7 @@
                 any(parentdir in self._roots
                     for parentdir in util.finddirs(dir)))
 
+    @encoding.strmethod
     def __repr__(self):
         return ('<includematcher includes=%r>' % self._pats)
 
@@ -452,6 +455,7 @@
     def isexact(self):
         return True
 
+    @encoding.strmethod
     def __repr__(self):
         return ('<exactmatcher files=%r>' % self._files)
 
@@ -492,6 +496,7 @@
     def isexact(self):
         return self._m1.isexact()
 
+    @encoding.strmethod
     def __repr__(self):
         return ('<differencematcher m1=%r, m2=%r>' % (self._m1, self._m2))
 
@@ -558,6 +563,7 @@
     def isexact(self):
         return self._m1.isexact() or self._m2.isexact()
 
+    @encoding.strmethod
     def __repr__(self):
         return ('<intersectionmatcher m1=%r, m2=%r>' % (self._m1, self._m2))
 
@@ -638,6 +644,7 @@
     def prefix(self):
         return self._matcher.prefix() and not self._always
 
+    @encoding.strmethod
     def __repr__(self):
         return ('<subdirmatcher path=%r, matcher=%r>' %
                 (self._path, self._matcher))
@@ -671,6 +678,7 @@
             r |= v
         return r
 
+    @encoding.strmethod
     def __repr__(self):
         return ('<unionmatcher matchers=%r>' % self._matchers)