##// END OF EJS Templates
match: implement __repr__() and update users (API)...
Martin von Zweigbergk -
r32406:95201747 default
parent child Browse files
Show More
@@ -148,19 +148,7 b' def _hashignore(ignore):'
148
148
149 """
149 """
150 sha1 = hashlib.sha1()
150 sha1 = hashlib.sha1()
151 if util.safehasattr(ignore, 'includepat'):
151 sha1.update(repr(ignore))
152 sha1.update(ignore.includepat)
153 sha1.update('\0\0')
154 if util.safehasattr(ignore, 'excludepat'):
155 sha1.update(ignore.excludepat)
156 sha1.update('\0\0')
157 if util.safehasattr(ignore, 'patternspat'):
158 sha1.update(ignore.patternspat)
159 sha1.update('\0\0')
160 if util.safehasattr(ignore, '_files'):
161 for f in ignore._files:
162 sha1.update(f)
163 sha1.update('\0')
164 return sha1.hexdigest()
152 return sha1.hexdigest()
165
153
166 _watchmanencoding = pywatchman.encoding.get_local_encoding()
154 _watchmanencoding = pywatchman.encoding.get_local_encoding()
@@ -810,11 +810,7 b' def debugignore(ui, repo, *files, **opts'
810 ignore = repo.dirstate._ignore
810 ignore = repo.dirstate._ignore
811 if not files:
811 if not files:
812 # Show all the patterns
812 # Show all the patterns
813 includepat = getattr(ignore, 'includepat', None)
813 ui.write("%s\n" % repr(ignore))
814 if includepat is not None:
815 ui.write("%s\n" % includepat)
816 else:
817 raise error.Abort(_("no ignore patterns found"))
818 else:
814 else:
819 for f in files:
815 for f in files:
820 nf = util.normpath(f)
816 nf = util.normpath(f)
@@ -214,6 +214,9 b' class matcher(object):'
214 self._anypats = bool(include or exclude)
214 self._anypats = bool(include or exclude)
215 self._always = False
215 self._always = False
216 self._pathrestricted = bool(include or exclude or patterns)
216 self._pathrestricted = bool(include or exclude or patterns)
217 self.patternspat = None
218 self.includepat = None
219 self.excludepat = None
217
220
218 # roots are directories which are recursively included/excluded.
221 # roots are directories which are recursively included/excluded.
219 self._includeroots = set()
222 self._includeroots = set()
@@ -375,6 +378,11 b' class matcher(object):'
375 def prefix(self):
378 def prefix(self):
376 return not self.always() and not self.isexact() and not self.anypats()
379 return not self.always() and not self.isexact() and not self.anypats()
377
380
381 def __repr__(self):
382 return ('<matcher files=%r, patterns=%r, includes=%r, excludes=%r>' %
383 (self._files, self.patternspat, self.includepat,
384 self.excludepat))
385
378 class subdirmatcher(matcher):
386 class subdirmatcher(matcher):
379 """Adapt a matcher to work on a subdirectory only.
387 """Adapt a matcher to work on a subdirectory only.
380
388
@@ -164,7 +164,7 b' Test relative ignore path (issue4473):'
164 A b.o
164 A b.o
165
165
166 $ hg debugignore
166 $ hg debugignore
167 (?:(?:|.*/)[^/]*(?:/|$))
167 <matcher files=[], patterns=None, includes='(?:(?:|.*/)[^/]*(?:/|$))', excludes=None>
168
168
169 $ hg debugignore b.o
169 $ hg debugignore b.o
170 b.o is ignored
170 b.o is ignored
General Comments 0
You need to be logged in to leave comments. Login now