##// END OF EJS Templates
sparse: override __repr__ in matchers...
Martin von Zweigbergk -
r33315:d2d4b210 default
parent child Browse files
Show More
@@ -928,12 +928,9 b' class forceincludematcher(object):'
928 def prefix(self):
928 def prefix(self):
929 return False
929 return False
930
930
931 def hash(self):
931 def __repr__(self):
932 sha1 = hashlib.sha1()
932 return ('<forceincludematcher matcher=%r, includes=%r>' %
933 sha1.update(_hashmatcher(self._matcher))
933 (self._matcher, sorted(self._includes)))
934 for include in sorted(self._includes):
935 sha1.update(include + '\0')
936 return sha1.hexdigest()
937
934
938 class unionmatcher(object):
935 class unionmatcher(object):
939 """A matcher that is the union of several matchers."""
936 """A matcher that is the union of several matchers."""
@@ -961,11 +958,8 b' class unionmatcher(object):'
961 def prefix(self):
958 def prefix(self):
962 return False
959 return False
963
960
964 def hash(self):
961 def __repr__(self):
965 sha1 = hashlib.sha1()
962 return ('<unionmatcher matchers=%r>' % self._matchers)
966 for m in self._matchers:
967 sha1.update(_hashmatcher(m))
968 return sha1.hexdigest()
969
963
970 class negatematcher(object):
964 class negatematcher(object):
971 def __init__(self, matcher):
965 def __init__(self, matcher):
@@ -986,16 +980,10 b' class negatematcher(object):'
986 def anypats(self):
980 def anypats(self):
987 return True
981 return True
988
982
989 def hash(self):
983 def __repr__(self):
990 sha1 = hashlib.sha1()
984 return ('<negatematcher matcher=%r>' % self._matcher)
991 sha1.update('negate')
992 sha1.update(_hashmatcher(self._matcher))
993 return sha1.hexdigest()
994
985
995 def _hashmatcher(matcher):
986 def _hashmatcher(matcher):
996 if util.safehasattr(matcher, 'hash'):
997 return matcher.hash()
998
999 sha1 = hashlib.sha1()
987 sha1 = hashlib.sha1()
1000 sha1.update(repr(matcher))
988 sha1.update(repr(matcher))
1001 return sha1.hexdigest()
989 return sha1.hexdigest()
General Comments 0
You need to be logged in to leave comments. Login now