##// END OF EJS Templates
ignore: use 'include:' rules instead of custom syntax...
Durham Goode -
r25216:dc562165 default
parent child Browse files
Show More
@@ -7,8 +7,9 b''
7
7
8 from node import nullid
8 from node import nullid
9 from i18n import _
9 from i18n import _
10 import scmutil, util, ignore, osutil, parsers, encoding, pathutil
10 import scmutil, util, osutil, parsers, encoding, pathutil
11 import os, stat, errno
11 import os, stat, errno
12 import match as matchmod
12
13
13 propertycache = util.propertycache
14 propertycache = util.propertycache
14 filecache = scmutil.filecache
15 filecache = scmutil.filecache
@@ -151,7 +152,12 b' class dirstate(object):'
151 # we need to use os.path.join here rather than self._join
152 # we need to use os.path.join here rather than self._join
152 # because path is arbitrary and user-specified
153 # because path is arbitrary and user-specified
153 files.append(os.path.join(self._rootdir, util.expandpath(path)))
154 files.append(os.path.join(self._rootdir, util.expandpath(path)))
154 return ignore.ignore(self._root, files, self._ui.warn)
155
156 if not files:
157 return util.never
158
159 pats = ['include:%s' % f for f in files]
160 return matchmod.match(self._root, '', [], pats, warn=self._ui.warn)
155
161
156 @propertycache
162 @propertycache
157 def _slash(self):
163 def _slash(self):
@@ -528,7 +528,21 b' def _anypats(kindpats):'
528 def readpatternfile(filepath, warn):
528 def readpatternfile(filepath, warn):
529 '''parse a pattern file, returning a list of
529 '''parse a pattern file, returning a list of
530 patterns. These patterns should be given to compile()
530 patterns. These patterns should be given to compile()
531 to be validated and converted into a match function.'''
531 to be validated and converted into a match function.
532
533 trailing white space is dropped.
534 the escape character is backslash.
535 comments start with #.
536 empty lines are skipped.
537
538 lines can be of the following formats:
539
540 syntax: regexp # defaults following lines to non-rooted regexps
541 syntax: glob # defaults following lines to non-rooted globs
542 re:pattern # non-rooted regular expression
543 glob:pattern # non-rooted glob
544 pattern # pattern of the current default type'''
545
532 syntaxes = {'re': 'relre:', 'regexp': 'relre:', 'glob': 'relglob:',
546 syntaxes = {'re': 'relre:', 'regexp': 'relre:', 'glob': 'relglob:',
533 'include': 'include'}
547 'include': 'include'}
534 syntax = 'relre:'
548 syntax = 'relre:'
@@ -189,3 +189,8 b" Check recursive uses of 'include:'"
189 $ echo "glob:*ignore" > nestedignore
189 $ echo "glob:*ignore" > nestedignore
190 $ hg status
190 $ hg status
191 A dir/b.o
191 A dir/b.o
192
193 $ echo "include:badignore" >> otherignore
194 $ hg status
195 skipping unreadable pattern file 'badignore': No such file or directory
196 A dir/b.o
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now