# HG changeset patch # User Laurent Charignon # Date 2015-12-23 19:52:54 # Node ID 0921caca7703ec7c86afbb964aa4dc028592cfc9 # Parent bc97b9af4e629ce28613c91f8fd96ba4721eab67 dirstate: extract logic to compute the list of ignorefiles We are going to reuse this logic to improve debugignore in the next patches of the series. diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -203,15 +203,7 @@ class dirstate(object): @rootcache('.hgignore') def _ignore(self): - files = [] - if os.path.exists(self._join('.hgignore')): - files.append(self._join('.hgignore')) - for name, path in self._ui.configitems("ui"): - if name == 'ignore' or name.startswith('ignore.'): - # we need to use os.path.join here rather than self._join - # because path is arbitrary and user-specified - files.append(os.path.join(self._rootdir, util.expandpath(path))) - + files = self._ignorefiles() if not files: return util.never @@ -774,6 +766,17 @@ class dirstate(object): return True return False + def _ignorefiles(self): + files = [] + if os.path.exists(self._join('.hgignore')): + files.append(self._join('.hgignore')) + for name, path in self._ui.configitems("ui"): + if name == 'ignore' or name.startswith('ignore.'): + # we need to use os.path.join here rather than self._join + # because path is arbitrary and user-specified + files.append(os.path.join(self._rootdir, util.expandpath(path))) + return files + def _walkexplicit(self, match, subrepos): '''Get stat data about the files explicitly specified by match.