# HG changeset patch # User Laurent Charignon # Date 1450900374 28800 # 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 -r bc97b9af4e62 -r 0921caca7703 mercurial/dirstate.py --- a/mercurial/dirstate.py Wed Dec 23 13:16:03 2015 -0800 +++ b/mercurial/dirstate.py Wed Dec 23 11:52:54 2015 -0800 @@ -203,15 +203,7 @@ @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 @@ 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.