mercurial/dirstate.py
changeset 27670 4374f039d269
parent 27594 0921caca7703
child 29097 ff4cc44364e3
equal deleted inserted replaced
27669:b1824a1725ed 27670:4374f039d269
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 from __future__ import absolute_import
     8 from __future__ import absolute_import
     9 
     9 
       
    10 import collections
    10 import errno
    11 import errno
    11 import os
    12 import os
    12 import stat
    13 import stat
    13 
    14 
    14 from .i18n import _
    15 from .i18n import _
   774             if name == 'ignore' or name.startswith('ignore.'):
   775             if name == 'ignore' or name.startswith('ignore.'):
   775                 # we need to use os.path.join here rather than self._join
   776                 # we need to use os.path.join here rather than self._join
   776                 # because path is arbitrary and user-specified
   777                 # because path is arbitrary and user-specified
   777                 files.append(os.path.join(self._rootdir, util.expandpath(path)))
   778                 files.append(os.path.join(self._rootdir, util.expandpath(path)))
   778         return files
   779         return files
       
   780 
       
   781     def _ignorefileandline(self, f):
       
   782         files = collections.deque(self._ignorefiles())
       
   783         visited = set()
       
   784         while files:
       
   785             i = files.popleft()
       
   786             patterns = matchmod.readpatternfile(i, self._ui.warn,
       
   787                                                 sourceinfo=True)
       
   788             for pattern, lineno, line in patterns:
       
   789                 kind, p = matchmod._patsplit(pattern, 'glob')
       
   790                 if kind == "subinclude":
       
   791                     if p not in visited:
       
   792                         files.append(p)
       
   793                     continue
       
   794                 m = matchmod.match(self._root, '', [], [pattern],
       
   795                                    warn=self._ui.warn)
       
   796                 if m(f):
       
   797                     return (i, lineno, line)
       
   798             visited.add(i)
       
   799         return (None, -1, "")
   779 
   800 
   780     def _walkexplicit(self, match, subrepos):
   801     def _walkexplicit(self, match, subrepos):
   781         '''Get stat data about the files explicitly specified by match.
   802         '''Get stat data about the files explicitly specified by match.
   782 
   803 
   783         Return a triple (results, dirsfound, dirsnotfound).
   804         Return a triple (results, dirsfound, dirsnotfound).