equal
deleted
inserted
replaced
926 return True |
926 return True |
927 |
927 |
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.""" |
940 def __init__(self, matchers): |
937 def __init__(self, matchers): |
941 self._matchers = matchers |
938 self._matchers = matchers |
959 return True |
956 return True |
960 |
957 |
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): |
972 self._matcher = matcher |
966 self._matcher = matcher |
973 |
967 |
984 return False |
978 return False |
985 |
979 |
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() |