repoview: include filter name in repr for debugging
authorYuya Nishihara <yuya@tcha.org>
Tue, 05 Dec 2017 21:56:48 +0900
changeset 40932 d4ad9d695a9e453b2ccd622207d14bca80550457
parent 40931 c752fbe228fb5fb5338b4b90efcfed7c2046ef7b
child 40933 84607c8b5af824af4e04b5f60fbbd882754cb85e
push id615
push usergszorc@mozilla.com
push dateFri, 08 Dec 2017 00:11:22 +0000
repoview: include filter name in repr for debugging
mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -10,16 +10,17 @@ from __future__ import absolute_import
 
 import copy
 import weakref
 
 from .node import nullrev
 from . import (
     obsolete,
     phases,
+    pycompat,
     tags as tagsmod,
 )
 
 def hideablerevs(repo):
     """Revision candidates to be hidden
 
     This is a standalone function to allow extensions to wrap it.
 
@@ -227,16 +228,21 @@ class repoview(object):
         return self._unfilteredrepo
 
     def filtered(self, name):
         """Return a filtered version of a repository"""
         if name == self.filtername:
             return self
         return self.unfiltered().filtered(name)
 
+    def __repr__(self):
+        return r'<%s:%s %r>' % (self.__class__.__name__,
+                                pycompat.sysstr(self.filtername),
+                                self.unfiltered())
+
     # everything access are forwarded to the proxied repo
     def __getattr__(self, attr):
         return getattr(self._unfilteredrepo, attr)
 
     def __setattr__(self, attr, value):
         return setattr(self._unfilteredrepo, attr, value)
 
     def __delattr__(self, attr):