diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py --- a/hgext/fsmonitor/__init__.py +++ b/hgext/fsmonitor/__init__.py @@ -148,19 +148,7 @@ def _hashignore(ignore): """ sha1 = hashlib.sha1() - if util.safehasattr(ignore, 'includepat'): - sha1.update(ignore.includepat) - sha1.update('\0\0') - if util.safehasattr(ignore, 'excludepat'): - sha1.update(ignore.excludepat) - sha1.update('\0\0') - if util.safehasattr(ignore, 'patternspat'): - sha1.update(ignore.patternspat) - sha1.update('\0\0') - if util.safehasattr(ignore, '_files'): - for f in ignore._files: - sha1.update(f) - sha1.update('\0') + sha1.update(repr(ignore)) return sha1.hexdigest() _watchmanencoding = pywatchman.encoding.get_local_encoding() diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -810,11 +810,7 @@ def debugignore(ui, repo, *files, **opts ignore = repo.dirstate._ignore if not files: # Show all the patterns - includepat = getattr(ignore, 'includepat', None) - if includepat is not None: - ui.write("%s\n" % includepat) - else: - raise error.Abort(_("no ignore patterns found")) + ui.write("%s\n" % repr(ignore)) else: for f in files: nf = util.normpath(f) diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -214,6 +214,9 @@ class matcher(object): self._anypats = bool(include or exclude) self._always = False self._pathrestricted = bool(include or exclude or patterns) + self.patternspat = None + self.includepat = None + self.excludepat = None # roots are directories which are recursively included/excluded. self._includeroots = set() @@ -375,6 +378,11 @@ class matcher(object): def prefix(self): return not self.always() and not self.isexact() and not self.anypats() + def __repr__(self): + return ('' % + (self._files, self.patternspat, self.includepat, + self.excludepat)) + class subdirmatcher(matcher): """Adapt a matcher to work on a subdirectory only. diff --git a/tests/test-hgignore.t b/tests/test-hgignore.t --- a/tests/test-hgignore.t +++ b/tests/test-hgignore.t @@ -164,7 +164,7 @@ Test relative ignore path (issue4473): A b.o $ hg debugignore - (?:(?:|.*/)[^/]*(?:/|$)) + $ hg debugignore b.o b.o is ignored