[PATCH 1 of 5] dirstate: extract logic to compute the list of ignorefiles
Laurent Charignon
lcharignon at fb.com
Wed Dec 23 20:42:18 UTC 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1450900374 28800
# Wed Dec 23 11:52:54 2015 -0800
# Node ID 327bb58234a16dacf42ea57ff4dcb2c698f28638
# Parent fe376159a58d9b3d748b669ac011b0eed0346fea
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
@@ -178,15 +178,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
@@ -735,6 +727,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.
More information about the Mercurial-devel
mailing list