changeset 27594:0921caca7703

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.
author Laurent Charignon <lcharignon@fb.com>
date Wed, 23 Dec 2015 11:52:54 -0800
parents bc97b9af4e62
children 9e2d01707e71
files mercurial/dirstate.py
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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.