##// END OF EJS Templates
match: delete unused root and cwd arguments from {always,never,exact}() (API)...
Martin von Zweigbergk -
r41825:0531dff7 default
parent child Browse files
Show More
@@ -476,7 +476,7 b' def overridestatus('
476
476
477 working = ctx2.rev() is None
477 working = ctx2.rev() is None
478 parentworking = working and ctx1 == self['.']
478 parentworking = working and ctx1 == self['.']
479 match = match or matchmod.always(self.root, self.getcwd())
479 match = match or matchmod.always()
480
480
481 # Maybe we can use this opportunity to update Watchman's state.
481 # Maybe we can use this opportunity to update Watchman's state.
482 # Mercurial uses workingcommitctx and/or memctx to represent the part of
482 # Mercurial uses workingcommitctx and/or memctx to represent the part of
@@ -297,7 +297,7 b' def _dosign(ui, repo, *revs, **opts):'
297 return
297 return
298
298
299 if not opts["force"]:
299 if not opts["force"]:
300 msigs = match.exact(repo.root, '', ['.hgsigs'])
300 msigs = match.exact(['.hgsigs'])
301 if any(repo.status(match=msigs, unknown=True, ignored=True)):
301 if any(repo.status(match=msigs, unknown=True, ignored=True)):
302 raise error.Abort(_("working copy of .hgsigs is changed "),
302 raise error.Abort(_("working copy of .hgsigs is changed "),
303 hint=_("please commit .hgsigs manually"))
303 hint=_("please commit .hgsigs manually"))
@@ -168,7 +168,7 b' def openlfdirstate(ui, repo, create=True'
168
168
169 def lfdirstatestatus(lfdirstate, repo):
169 def lfdirstatestatus(lfdirstate, repo):
170 pctx = repo['.']
170 pctx = repo['.']
171 match = matchmod.always(repo.root, repo.getcwd())
171 match = matchmod.always()
172 unsure, s = lfdirstate.status(match, subrepos=[], ignored=False,
172 unsure, s = lfdirstate.status(match, subrepos=[], ignored=False,
173 clean=False, unknown=False)
173 clean=False, unknown=False)
174 modified, clean = s.modified, s.clean
174 modified, clean = s.modified, s.clean
@@ -552,7 +552,7 b' def updatestandinsbymatch(repo, match):'
552 # otherwise to update all standins if the largefiles are
552 # otherwise to update all standins if the largefiles are
553 # large.
553 # large.
554 lfdirstate = openlfdirstate(ui, repo)
554 lfdirstate = openlfdirstate(ui, repo)
555 dirtymatch = matchmod.always(repo.root, repo.getcwd())
555 dirtymatch = matchmod.always()
556 unsure, s = lfdirstate.status(dirtymatch, subrepos=[], ignored=False,
556 unsure, s = lfdirstate.status(dirtymatch, subrepos=[], ignored=False,
557 clean=False, unknown=False)
557 clean=False, unknown=False)
558 modifiedfiles = unsure + s.modified + s.added + s.removed
558 modifiedfiles = unsure + s.modified + s.added + s.removed
@@ -1222,9 +1222,8 b' def scmutiladdremove(orig, repo, matcher'
1222 return orig(repo, matcher, prefix, uipathfn, opts)
1222 return orig(repo, matcher, prefix, uipathfn, opts)
1223 # Get the list of missing largefiles so we can remove them
1223 # Get the list of missing largefiles so we can remove them
1224 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1224 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1225 unsure, s = lfdirstate.status(matchmod.always(repo.root, repo.getcwd()),
1225 unsure, s = lfdirstate.status(matchmod.always(), subrepos=[],
1226 subrepos=[], ignored=False, clean=False,
1226 ignored=False, clean=False, unknown=False)
1227 unknown=False)
1228
1227
1229 # Call into the normal remove code, but the removing of the standin, we want
1228 # Call into the normal remove code, but the removing of the standin, we want
1230 # to have handled by original addremove. Monkey patching here makes sure
1229 # to have handled by original addremove. Monkey patching here makes sure
@@ -1414,10 +1413,8 b' def mergeupdate(orig, repo, node, branch'
1414 # (*1) deprecated, but used internally (e.g: "rebase --collapse")
1413 # (*1) deprecated, but used internally (e.g: "rebase --collapse")
1415
1414
1416 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1415 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1417 unsure, s = lfdirstate.status(matchmod.always(repo.root,
1416 unsure, s = lfdirstate.status(matchmod.always(), subrepos=[],
1418 repo.getcwd()),
1417 ignored=False, clean=True, unknown=False)
1419 subrepos=[], ignored=False,
1420 clean=True, unknown=False)
1421 oldclean = set(s.clean)
1418 oldclean = set(s.clean)
1422 pctx = repo['.']
1419 pctx = repo['.']
1423 dctx = repo[node]
1420 dctx = repo[node]
@@ -103,7 +103,7 b' def reposetup(ui, repo):'
103 parentworking = working and ctx1 == self['.']
103 parentworking = working and ctx1 == self['.']
104
104
105 if match is None:
105 if match is None:
106 match = matchmod.always(self.root, self.getcwd())
106 match = matchmod.always()
107
107
108 wlock = None
108 wlock = None
109 try:
109 try:
@@ -54,7 +54,7 b' def setupserver(ui, repo):'
54 elif cap.startswith("excludepattern="):
54 elif cap.startswith("excludepattern="):
55 excludepattern = cap[len("excludepattern="):].split('\0')
55 excludepattern = cap[len("excludepattern="):].split('\0')
56
56
57 m = match.always(repo.root, '')
57 m = match.always()
58 if includepattern or excludepattern:
58 if includepattern or excludepattern:
59 m = match.match(repo.root, '', None,
59 m = match.match(repo.root, '', None,
60 includepattern, excludepattern)
60 includepattern, excludepattern)
@@ -104,7 +104,7 b' def onetimesetup(ui):'
104 oldnoflatmf = state.noflatmf
104 oldnoflatmf = state.noflatmf
105 try:
105 try:
106 state.shallowremote = True
106 state.shallowremote = True
107 state.match = match.always(repo.root, '')
107 state.match = match.always()
108 state.noflatmf = other.get('noflatmanifest') == 'True'
108 state.noflatmf = other.get('noflatmanifest') == 'True'
109 if includepattern or excludepattern:
109 if includepattern or excludepattern:
110 state.match = match.match(repo.root, '', None,
110 state.match = match.match(repo.root, '', None,
@@ -162,7 +162,7 b' def makechangegroup(orig, repo, outgoing'
162 repo.shallowmatch = match.match(repo.root, '', None,
162 repo.shallowmatch = match.match(repo.root, '', None,
163 includepattern, excludepattern)
163 includepattern, excludepattern)
164 else:
164 else:
165 repo.shallowmatch = match.always(repo.root, '')
165 repo.shallowmatch = match.always()
166 return orig(repo, outgoing, version, source, *args, **kwargs)
166 return orig(repo, outgoing, version, source, *args, **kwargs)
167 finally:
167 finally:
168 repo.shallowmatch = original
168 repo.shallowmatch = original
@@ -289,7 +289,7 b' def wraprepo(repo):'
289
289
290 repo.__class__ = shallowrepository
290 repo.__class__ = shallowrepository
291
291
292 repo.shallowmatch = match.always(repo.root, '')
292 repo.shallowmatch = match.always()
293
293
294 makeunionstores(repo)
294 makeunionstores(repo)
295
295
@@ -199,7 +199,7 b' def _setupdirstate(ui):'
199 def walk(orig, self, match, subrepos, unknown, ignored, full=True):
199 def walk(orig, self, match, subrepos, unknown, ignored, full=True):
200 # hack to not exclude explicitly-specified paths so that they can
200 # hack to not exclude explicitly-specified paths so that they can
201 # be warned later on e.g. dirstate.add()
201 # be warned later on e.g. dirstate.add()
202 em = matchmod.exact(None, None, match.files())
202 em = matchmod.exact(match.files())
203 sm = matchmod.unionmatcher([self._sparsematcher, em])
203 sm = matchmod.unionmatcher([self._sparsematcher, em])
204 match = matchmod.intersectmatchers(match, sm)
204 match = matchmod.intersectmatchers(match, sm)
205 return orig(self, match, subrepos, unknown, ignored, full)
205 return orig(self, match, subrepos, unknown, ignored, full)
@@ -325,9 +325,9 b' class transplanter(object):'
325 if merge:
325 if merge:
326 p1 = repo.dirstate.p1()
326 p1 = repo.dirstate.p1()
327 repo.setparents(p1, node)
327 repo.setparents(p1, node)
328 m = match.always(repo.root, '')
328 m = match.always()
329 else:
329 else:
330 m = match.exact(repo.root, '', files)
330 m = match.exact(files)
331
331
332 n = repo.commit(message, user, date, extra=extra, match=m,
332 n = repo.commit(message, user, date, extra=extra, match=m,
333 editor=self.getcommiteditor())
333 editor=self.getcommiteditor())
@@ -1313,9 +1313,9 b' def getbundler(version, repo, bundlecaps'
1313 assert version in supportedoutgoingversions(repo)
1313 assert version in supportedoutgoingversions(repo)
1314
1314
1315 if matcher is None:
1315 if matcher is None:
1316 matcher = matchmod.always(repo.root, '')
1316 matcher = matchmod.always()
1317 if oldmatcher is None:
1317 if oldmatcher is None:
1318 oldmatcher = matchmod.never(repo.root, '')
1318 oldmatcher = matchmod.never()
1319
1319
1320 if version == '01' and not matcher.always():
1320 if version == '01' and not matcher.always():
1321 raise error.ProgrammingError('version 01 changegroups do not support '
1321 raise error.ProgrammingError('version 01 changegroups do not support '
@@ -148,7 +148,7 b' class dirstate(object):'
148 def _ignore(self):
148 def _ignore(self):
149 files = self._ignorefiles()
149 files = self._ignorefiles()
150 if not files:
150 if not files:
151 return matchmod.never(self._root, '')
151 return matchmod.never()
152
152
153 pats = ['include:%s' % f for f in files]
153 pats = ['include:%s' % f for f in files]
154 return matchmod.match(self._root, '', [], pats, warn=self._ui.warn)
154 return matchmod.match(self._root, '', [], pats, warn=self._ui.warn)
@@ -538,8 +538,7 b' class matchctx(object):'
538
538
539 def never(self):
539 def never(self):
540 """Create a matcher to select nothing"""
540 """Create a matcher to select nothing"""
541 repo = self.ctx.repo()
541 return matchmod.never(badfn=self._badfn)
542 return matchmod.never(repo.root, repo.getcwd(), badfn=self._badfn)
543
542
544 def match(ctx, expr, badfn=None):
543 def match(ctx, expr, badfn=None):
545 """Create a matcher for a single fileset expression"""
544 """Create a matcher for a single fileset expression"""
@@ -565,9 +565,9 b' def _prettyprintdifflines(context, lines'
565 def _diffsgen(context, repo, ctx, basectx, files, style, stripecount,
565 def _diffsgen(context, repo, ctx, basectx, files, style, stripecount,
566 linerange, lineidprefix):
566 linerange, lineidprefix):
567 if files:
567 if files:
568 m = match.exact(repo.root, repo.getcwd(), files)
568 m = match.exact(files)
569 else:
569 else:
570 m = match.always(repo.root, repo.getcwd())
570 m = match.always()
571
571
572 diffopts = patch.diffopts(repo.ui, untrusted=True)
572 diffopts = patch.diffopts(repo.ui, untrusted=True)
573 parity = paritygen(stripecount)
573 parity = paritygen(stripecount)
@@ -1227,14 +1227,14 b' class localrepository(object):'
1227 @storecache(narrowspec.FILENAME)
1227 @storecache(narrowspec.FILENAME)
1228 def _storenarrowmatch(self):
1228 def _storenarrowmatch(self):
1229 if repository.NARROW_REQUIREMENT not in self.requirements:
1229 if repository.NARROW_REQUIREMENT not in self.requirements:
1230 return matchmod.always(self.root, '')
1230 return matchmod.always()
1231 include, exclude = self.narrowpats
1231 include, exclude = self.narrowpats
1232 return narrowspec.match(self.root, include=include, exclude=exclude)
1232 return narrowspec.match(self.root, include=include, exclude=exclude)
1233
1233
1234 @storecache(narrowspec.FILENAME)
1234 @storecache(narrowspec.FILENAME)
1235 def _narrowmatch(self):
1235 def _narrowmatch(self):
1236 if repository.NARROW_REQUIREMENT not in self.requirements:
1236 if repository.NARROW_REQUIREMENT not in self.requirements:
1237 return matchmod.always(self.root, '')
1237 return matchmod.always()
1238 narrowspec.checkworkingcopynarrowspec(self)
1238 narrowspec.checkworkingcopynarrowspec(self)
1239 include, exclude = self.narrowpats
1239 include, exclude = self.narrowpats
1240 return narrowspec.match(self.root, include=include, exclude=exclude)
1240 return narrowspec.match(self.root, include=include, exclude=exclude)
@@ -1252,7 +1252,7 b' class localrepository(object):'
1252 if includeexact and not self._narrowmatch.always():
1252 if includeexact and not self._narrowmatch.always():
1253 # do not exclude explicitly-specified paths so that they can
1253 # do not exclude explicitly-specified paths so that they can
1254 # be warned later on
1254 # be warned later on
1255 em = matchmod.exact(None, None, match.files())
1255 em = matchmod.exact(match.files())
1256 nm = matchmod.unionmatcher([self._narrowmatch, em])
1256 nm = matchmod.unionmatcher([self._narrowmatch, em])
1257 return matchmod.intersectmatchers(match, nm)
1257 return matchmod.intersectmatchers(match, nm)
1258 return matchmod.intersectmatchers(match, self._narrowmatch)
1258 return matchmod.intersectmatchers(match, self._narrowmatch)
@@ -2400,7 +2400,7 b' class localrepository(object):'
2400 raise error.Abort('%s: %s' % (f, msg))
2400 raise error.Abort('%s: %s' % (f, msg))
2401
2401
2402 if not match:
2402 if not match:
2403 match = matchmod.always(self.root, '')
2403 match = matchmod.always()
2404
2404
2405 if not force:
2405 if not force:
2406 vdirs = []
2406 vdirs = []
@@ -190,14 +190,14 b' def match(root, cwd, patterns=None, incl'
190 m = differencematcher(m, em)
190 m = differencematcher(m, em)
191 return m
191 return m
192
192
193 def exact(root, cwd, files, badfn=None):
193 def exact(files, badfn=None):
194 return exactmatcher(files, badfn=badfn)
194 return exactmatcher(files, badfn=badfn)
195
195
196 def always(root, cwd, badfn=None):
196 def always(badfn=None):
197 return alwaysmatcher(badfn=badfn)
197 return alwaysmatcher(badfn)
198
198
199 def never(root, cwd, badfn=None):
199 def never(badfn=None):
200 return nevermatcher(badfn=badfn)
200 return nevermatcher(badfn)
201
201
202 def badmatch(match, badfn):
202 def badmatch(match, badfn):
203 """Make a copy of the given matcher, replacing its bad method with the given
203 """Make a copy of the given matcher, replacing its bad method with the given
@@ -127,7 +127,7 b' def match(root, include=None, exclude=No'
127 # Passing empty include and empty exclude to matchmod.match()
127 # Passing empty include and empty exclude to matchmod.match()
128 # gives a matcher that matches everything, so explicitly use
128 # gives a matcher that matches everything, so explicitly use
129 # the nevermatcher.
129 # the nevermatcher.
130 return matchmod.never(root, '')
130 return matchmod.never()
131 return matchmod.match(root, '', [], include=include or [],
131 return matchmod.match(root, '', [], include=include or [],
132 exclude=exclude or [])
132 exclude=exclude or [])
133
133
@@ -2073,7 +2073,7 b' def subrepo(repo, subset, x):'
2073 if len(args) != 0:
2073 if len(args) != 0:
2074 pat = getstring(args[0], _("subrepo requires a pattern"))
2074 pat = getstring(args[0], _("subrepo requires a pattern"))
2075
2075
2076 m = matchmod.exact(repo.root, repo.root, ['.hgsubstate'])
2076 m = matchmod.exact(['.hgsubstate'])
2077
2077
2078 def submatches(names):
2078 def submatches(names):
2079 k, p, m = stringutil.stringmatcher(pat)
2079 k, p, m = stringutil.stringmatcher(pat)
@@ -821,11 +821,11 b' def match(ctx, pats=(), opts=None, globb'
821
821
822 def matchall(repo):
822 def matchall(repo):
823 '''Return a matcher that will efficiently match everything.'''
823 '''Return a matcher that will efficiently match everything.'''
824 return matchmod.always(repo.root, repo.getcwd())
824 return matchmod.always()
825
825
826 def matchfiles(repo, files, badfn=None):
826 def matchfiles(repo, files, badfn=None):
827 '''Return a matcher that will efficiently match exactly these files.'''
827 '''Return a matcher that will efficiently match exactly these files.'''
828 return matchmod.exact(repo.root, repo.getcwd(), files, badfn=badfn)
828 return matchmod.exact(files, badfn=badfn)
829
829
830 def parsefollowlinespattern(repo, rev, pat, msg):
830 def parsefollowlinespattern(repo, rev, pat, msg):
831 """Return a file name from `pat` pattern suitable for usage in followlines
831 """Return a file name from `pat` pattern suitable for usage in followlines
@@ -277,7 +277,7 b' def matcher(repo, revs=None, includetemp'
277 """
277 """
278 # If sparse isn't enabled, sparse matcher matches everything.
278 # If sparse isn't enabled, sparse matcher matches everything.
279 if not enabled:
279 if not enabled:
280 return matchmod.always(repo.root, '')
280 return matchmod.always()
281
281
282 if not revs or revs == [None]:
282 if not revs or revs == [None]:
283 revs = [repo.changelog.rev(node)
283 revs = [repo.changelog.rev(node)
@@ -305,7 +305,7 b' def matcher(repo, revs=None, includetemp'
305 pass
305 pass
306
306
307 if not matchers:
307 if not matchers:
308 result = matchmod.always(repo.root, '')
308 result = matchmod.always()
309 elif len(matchers) == 1:
309 elif len(matchers) == 1:
310 result = matchers[0]
310 result = matchers[0]
311 else:
311 else:
@@ -323,7 +323,7 b' class abstractsubrepo(object):'
323
323
324 def matchfileset(self, expr, badfn=None):
324 def matchfileset(self, expr, badfn=None):
325 """Resolve the fileset expression for this repo"""
325 """Resolve the fileset expression for this repo"""
326 return matchmod.never(self.wvfs.base, '', badfn=badfn)
326 return matchmod.never(badfn=badfn)
327
327
328 def printfiles(self, ui, m, fm, fmt, subrepos):
328 def printfiles(self, ui, m, fm, fmt, subrepos):
329 """handle the files command for this subrepo"""
329 """handle the files command for this subrepo"""
@@ -807,12 +807,11 b' class hgsubrepo(abstractsubrepo):'
807
807
808 @annotatesubrepoerror
808 @annotatesubrepoerror
809 def matchfileset(self, expr, badfn=None):
809 def matchfileset(self, expr, badfn=None):
810 repo = self._repo
811 if self._ctx.rev() is None:
810 if self._ctx.rev() is None:
812 ctx = repo[None]
811 ctx = self._repo[None]
813 else:
812 else:
814 rev = self._state[1]
813 rev = self._state[1]
815 ctx = repo[rev]
814 ctx = self._repo[rev]
816
815
817 matchers = [ctx.matchfileset(expr, badfn=badfn)]
816 matchers = [ctx.matchfileset(expr, badfn=badfn)]
818
817
@@ -536,7 +536,7 b' def tag(repo, names, node, message, loca'
536 date: date tuple to use if committing'''
536 date: date tuple to use if committing'''
537
537
538 if not local:
538 if not local:
539 m = matchmod.exact(repo.root, '', ['.hgtags'])
539 m = matchmod.exact(['.hgtags'])
540 if any(repo.status(match=m, unknown=True, ignored=True)):
540 if any(repo.status(match=m, unknown=True, ignored=True)):
541 raise error.Abort(_('working copy of .hgtags is changed'),
541 raise error.Abort(_('working copy of .hgtags is changed'),
542 hint=_('please commit .hgtags manually'))
542 hint=_('please commit .hgtags manually'))
@@ -610,7 +610,7 b' def _tag(repo, names, node, message, loc'
610 if '.hgtags' not in repo.dirstate:
610 if '.hgtags' not in repo.dirstate:
611 repo[None].add(['.hgtags'])
611 repo[None].add(['.hgtags'])
612
612
613 m = matchmod.exact(repo.root, '', ['.hgtags'])
613 m = matchmod.exact(['.hgtags'])
614 tagnode = repo.commit(message, user, date, extra=extra, match=m,
614 tagnode = repo.commit(message, user, date, extra=extra, match=m,
615 editor=editor)
615 editor=editor)
616
616
@@ -289,8 +289,7 b' class basemanifesttests(object):'
289 the resulting manifest.'''
289 the resulting manifest.'''
290 m = self.parsemanifest(A_HUGE_MANIFEST)
290 m = self.parsemanifest(A_HUGE_MANIFEST)
291
291
292 match = matchmod.exact(b'/', b'',
292 match = matchmod.exact([b'file1', b'file200', b'file300'])
293 [b'file1', b'file200', b'file300'])
294 m2 = m.matches(match)
293 m2 = m.matches(match)
295
294
296 w = (b'file1\0%sx\n'
295 w = (b'file1\0%sx\n'
@@ -304,9 +303,8 b' class basemanifesttests(object):'
304 '''
303 '''
305 m = self.parsemanifest(A_DEEPER_MANIFEST)
304 m = self.parsemanifest(A_DEEPER_MANIFEST)
306
305
307 match = matchmod.exact(b'/', b'',
306 match = matchmod.exact([b'a/b/c/bar.txt', b'a/b/d/qux.py',
308 [b'a/b/c/bar.txt', b'a/b/d/qux.py',
307 b'readme.txt', b'nonexistent'])
309 b'readme.txt', b'nonexistent'])
310 m2 = m.matches(match)
308 m2 = m.matches(match)
311
309
312 self.assertEqual(
310 self.assertEqual(
@@ -329,7 +327,7 b' class basemanifesttests(object):'
329 m = self.parsemanifest(A_HUGE_MANIFEST)
327 m = self.parsemanifest(A_HUGE_MANIFEST)
330
328
331 flist = m.keys()[80:300]
329 flist = m.keys()[80:300]
332 match = matchmod.exact(b'/', b'', flist)
330 match = matchmod.exact(flist)
333 m2 = m.matches(match)
331 m2 = m.matches(match)
334
332
335 self.assertEqual(flist, m2.keys())
333 self.assertEqual(flist, m2.keys())
@@ -363,7 +361,7 b' class basemanifesttests(object):'
363 against a directory.'''
361 against a directory.'''
364 m = self.parsemanifest(A_DEEPER_MANIFEST)
362 m = self.parsemanifest(A_DEEPER_MANIFEST)
365
363
366 match = matchmod.exact(b'/', b'', [b'a/b'])
364 match = matchmod.exact([b'a/b'])
367 m2 = m.matches(match)
365 m2 = m.matches(match)
368
366
369 self.assertEqual([], m2.keys())
367 self.assertEqual([], m2.keys())
@@ -185,7 +185,7 b' class IncludeMatcherTests(unittest.TestC'
185 class ExactMatcherTests(unittest.TestCase):
185 class ExactMatcherTests(unittest.TestCase):
186
186
187 def testVisitdir(self):
187 def testVisitdir(self):
188 m = matchmod.exact(b'x', b'', files=[b'dir/subdir/foo.txt'])
188 m = matchmod.exact(files=[b'dir/subdir/foo.txt'])
189 assert isinstance(m, matchmod.exactmatcher)
189 assert isinstance(m, matchmod.exactmatcher)
190 self.assertTrue(m.visitdir(b'.'))
190 self.assertTrue(m.visitdir(b'.'))
191 self.assertTrue(m.visitdir(b'dir'))
191 self.assertTrue(m.visitdir(b'dir'))
@@ -196,7 +196,7 b' class ExactMatcherTests(unittest.TestCas'
196 self.assertFalse(m.visitdir(b'folder'))
196 self.assertFalse(m.visitdir(b'folder'))
197
197
198 def testVisitchildrenset(self):
198 def testVisitchildrenset(self):
199 m = matchmod.exact(b'x', b'', files=[b'dir/subdir/foo.txt'])
199 m = matchmod.exact(files=[b'dir/subdir/foo.txt'])
200 assert isinstance(m, matchmod.exactmatcher)
200 assert isinstance(m, matchmod.exactmatcher)
201 self.assertEqual(m.visitchildrenset(b'.'), {b'dir'})
201 self.assertEqual(m.visitchildrenset(b'.'), {b'dir'})
202 self.assertEqual(m.visitchildrenset(b'dir'), {b'subdir'})
202 self.assertEqual(m.visitchildrenset(b'dir'), {b'subdir'})
@@ -206,11 +206,11 b' class ExactMatcherTests(unittest.TestCas'
206 self.assertEqual(m.visitchildrenset(b'folder'), set())
206 self.assertEqual(m.visitchildrenset(b'folder'), set())
207
207
208 def testVisitchildrensetFilesAndDirs(self):
208 def testVisitchildrensetFilesAndDirs(self):
209 m = matchmod.exact(b'x', b'', files=[b'rootfile.txt',
209 m = matchmod.exact(files=[b'rootfile.txt',
210 b'a/file1.txt',
210 b'a/file1.txt',
211 b'a/b/file2.txt',
211 b'a/b/file2.txt',
212 # no file in a/b/c
212 # no file in a/b/c
213 b'a/b/c/d/file4.txt'])
213 b'a/b/c/d/file4.txt'])
214 assert isinstance(m, matchmod.exactmatcher)
214 assert isinstance(m, matchmod.exactmatcher)
215 self.assertEqual(m.visitchildrenset(b'.'), {b'a', b'rootfile.txt'})
215 self.assertEqual(m.visitchildrenset(b'.'), {b'a', b'rootfile.txt'})
216 self.assertEqual(m.visitchildrenset(b'a'), {b'b', b'file1.txt'})
216 self.assertEqual(m.visitchildrenset(b'a'), {b'b', b'file1.txt'})
General Comments 0
You need to be logged in to leave comments. Login now