D2109: py3: make sure we return str from __repr__

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sun Feb 11 12:39:04 UTC 2018


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  1. skip-blame because we are just adding r'' prefixes

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2109

AFFECTED FILES
  mercurial/match.py

CHANGE DETAILS

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -345,7 +345,7 @@
         return 'all'
 
     def __repr__(self):
-        return '<alwaysmatcher>'
+        return r'<alwaysmatcher>'
 
 class nevermatcher(basematcher):
     '''Matches nothing.'''
@@ -368,7 +368,7 @@
         return False
 
     def __repr__(self):
-        return '<nevermatcher>'
+        return r'<nevermatcher>'
 
 class patternmatcher(basematcher):
 
@@ -398,7 +398,7 @@
         return self._prefix
 
     def __repr__(self):
-        return ('<patternmatcher patterns=%r>' % self._pats)
+        return (r'<patternmatcher patterns=%r>' % self._pats)
 
 class includematcher(basematcher):
 
@@ -425,7 +425,7 @@
                     for parentdir in util.finddirs(dir)))
 
     def __repr__(self):
-        return ('<includematcher includes=%r>' % self._pats)
+        return (r'<includematcher includes=%r>' % self._pats)
 
 class exactmatcher(basematcher):
     '''Matches the input files exactly. They are interpreted as paths, not
@@ -453,7 +453,7 @@
         return True
 
     def __repr__(self):
-        return ('<exactmatcher files=%r>' % self._files)
+        return (r'<exactmatcher files=%r>' % self._files)
 
 class differencematcher(basematcher):
     '''Composes two matchers by matching if the first matches and the second
@@ -493,7 +493,7 @@
         return self._m1.isexact()
 
     def __repr__(self):
-        return ('<differencematcher m1=%r, m2=%r>' % (self._m1, self._m2))
+        return (r'<differencematcher m1=%r, m2=%r>' % (self._m1, self._m2))
 
 def intersectmatchers(m1, m2):
     '''Composes two matchers by matching if both of them match.
@@ -559,7 +559,7 @@
         return self._m1.isexact() or self._m2.isexact()
 
     def __repr__(self):
-        return ('<intersectionmatcher m1=%r, m2=%r>' % (self._m1, self._m2))
+        return (r'<intersectionmatcher m1=%r, m2=%r>' % (self._m1, self._m2))
 
 class subdirmatcher(basematcher):
     """Adapt a matcher to work on a subdirectory only.
@@ -639,7 +639,7 @@
         return self._matcher.prefix() and not self._always
 
     def __repr__(self):
-        return ('<subdirmatcher path=%r, matcher=%r>' %
+        return (r'<subdirmatcher path=%r, matcher=%r>' %
                 (self._path, self._matcher))
 
 class unionmatcher(basematcher):
@@ -672,7 +672,7 @@
         return r
 
     def __repr__(self):
-        return ('<unionmatcher matchers=%r>' % self._matchers)
+        return (r'<unionmatcher matchers=%r>' % self._matchers)
 
 def patkind(pattern, default=None):
     '''If pattern is 'kind:pat' with a known kind, return kind.'''



To: pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list