match: use '' instead of '.' for root directory (API)
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 15 May 2017 00:12:19 -0700
changeset 42341 27d6956d386b
parent 42340 7ada598941d2
child 42342 448486e12c13
match: use '' instead of '.' for root directory (API) I think '' is generally a better value for the root directory than '.' is. For example, os.path.join('', 'foo') => 'foo', while os.path.join('.', 'foo') => './foo'. This patch mostly makes it so we use '' internally in match.py. However, it also affects the API in visitdir(), visitchildrenset() and files(). The two former now also accept '' as input. I've updated the callers of these methods. I've also added a deprecation warning for passing '.' (for external callers). The only caller I could find that was affected by files() returning '' instead of '.' was in dirstate.walk(). I've updated that. The next few patches show some workarounds we can remove by using '' instead of '.'. Differential Revision: https://phab.mercurial-scm.org/D6401
hgext/narrow/narrowcommands.py
mercurial/changegroup.py
mercurial/dirstate.py
mercurial/manifest.py
mercurial/match.py
mercurial/store.py
relnotes/next
tests/test-match.py
--- a/hgext/narrow/narrowcommands.py	Wed Apr 24 09:32:29 2019 -0700
+++ b/hgext/narrow/narrowcommands.py	Mon May 15 00:12:19 2017 -0700
@@ -216,7 +216,7 @@
                     todelete.append(f)
             elif f.startswith('meta/'):
                 dir = f[5:-13]
-                dirs = ['.'] + sorted(util.dirs({dir})) + [dir]
+                dirs = [''] + sorted(util.dirs({dir})) + [dir]
                 include = True
                 for d in dirs:
                     visit = newmatch.visitdir(d)
--- a/mercurial/changegroup.py	Wed Apr 24 09:32:29 2019 -0700
+++ b/mercurial/changegroup.py	Mon May 15 00:12:19 2017 -0700
@@ -1061,7 +1061,7 @@
         while tmfnodes:
             tree, nodes = tmfnodes.popitem()
 
-            should_visit = self._matcher.visitdir(tree[:-1] or '.')
+            should_visit = self._matcher.visitdir(tree[:-1])
             if tree and not should_visit:
                 continue
 
@@ -1093,7 +1093,7 @@
                 fullclnodes=self._fullclnodes,
                 precomputedellipsis=self._precomputedellipsis)
 
-            if not self._oldmatcher.visitdir(store.tree[:-1] or '.'):
+            if not self._oldmatcher.visitdir(store.tree[:-1]):
                 yield tree, deltas
             else:
                 # 'deltas' is a generator and we need to consume it even if
--- a/mercurial/dirstate.py	Wed Apr 24 09:32:29 2019 -0700
+++ b/mercurial/dirstate.py	Mon May 15 00:12:19 2017 -0700
@@ -757,10 +757,10 @@
                 del files[i]
             j += 1
 
-        if not files or '.' in files:
-            files = ['.']
+        if not files or '' in files:
+            files = ['']
             # constructing the foldmap is expensive, so don't do it for the
-            # common case where files is ['.']
+            # common case where files is ['']
             normalize = None
         results = dict.fromkeys(subrepos)
         results['.hg'] = None
@@ -910,9 +910,7 @@
                 if visitentries == 'this' or visitentries == 'all':
                     visitentries = None
                 skip = None
-                if nd == '.':
-                    nd = ''
-                else:
+                if nd != '':
                     skip = '.hg'
                 try:
                     entries = listdir(join(nd), stat=True, skip=skip)
--- a/mercurial/manifest.py	Wed Apr 24 09:32:29 2019 -0700
+++ b/mercurial/manifest.py	Mon May 15 00:12:19 2017 -0700
@@ -466,9 +466,9 @@
             if match(fn):
                 yield fn
 
-        # for dirstate.walk, files=['.'] means "walk the whole tree".
+        # for dirstate.walk, files=[''] means "walk the whole tree".
         # follow that here, too
-        fset.discard('.')
+        fset.discard('')
 
         for fn in sorted(fset):
             if not self.hasdir(fn):
@@ -1038,9 +1038,9 @@
                 fset.remove(fn)
             yield fn
 
-        # for dirstate.walk, files=['.'] means "walk the whole tree".
+        # for dirstate.walk, files=[''] means "walk the whole tree".
         # follow that here, too
-        fset.discard('.')
+        fset.discard('')
 
         for fn in sorted(fset):
             if not self.hasdir(fn):
@@ -1048,7 +1048,7 @@
 
     def _walk(self, match):
         '''Recursively generates matching file names for walk().'''
-        visit = match.visitchildrenset(self._dir[:-1] or '.')
+        visit = match.visitchildrenset(self._dir[:-1])
         if not visit:
             return
 
@@ -1076,7 +1076,7 @@
         '''recursively generate a new manifest filtered by the match argument.
         '''
 
-        visit = match.visitchildrenset(self._dir[:-1] or '.')
+        visit = match.visitchildrenset(self._dir[:-1])
         if visit == 'all':
             return self.copy()
         ret = treemanifest(self._dir)
@@ -1235,7 +1235,7 @@
             return m._dirs.get(d, emptytree)._node
 
         # let's skip investigating things that `match` says we do not need.
-        visit = match.visitchildrenset(self._dir[:-1] or '.')
+        visit = match.visitchildrenset(self._dir[:-1])
         visit = self._loadchildrensetlazy(visit)
         if visit == 'this' or visit == 'all':
             visit = None
@@ -1254,7 +1254,7 @@
 
         If `matcher` is provided, it only returns subtrees that match.
         """
-        if matcher and not matcher.visitdir(self._dir[:-1] or '.'):
+        if matcher and not matcher.visitdir(self._dir[:-1]):
             return
         if not matcher or matcher(self._dir[:-1]):
             yield self
@@ -1685,7 +1685,7 @@
             return self._dirmancache[tree][node]
 
         if not self._narrowmatch.always():
-            if not self._narrowmatch.visitdir(tree[:-1] or '.'):
+            if not self._narrowmatch.visitdir(tree[:-1]):
                 return excludeddirmanifestctx(tree, node)
         if tree:
             if self._rootstore._treeondisk:
@@ -1878,7 +1878,7 @@
     def _storage(self):
         narrowmatch = self._manifestlog._narrowmatch
         if not narrowmatch.always():
-            if not narrowmatch.visitdir(self._dir[:-1] or '.'):
+            if not narrowmatch.visitdir(self._dir[:-1]):
                 return excludedmanifestrevlog(self._dir)
         return self._manifestlog.getstorage(self._dir)
 
--- a/mercurial/match.py	Wed Apr 24 09:32:29 2019 -0700
+++ b/mercurial/match.py	Mon May 15 00:12:19 2017 -0700
@@ -380,7 +380,7 @@
           the following values (assuming the implementation of visitchildrenset
           is capable of recognizing this; some implementations are not).
 
-          '.' -> {'foo', 'qux'}
+          '' -> {'foo', 'qux'}
           'baz' -> set()
           'foo' -> {'bar'}
           # Ideally this would be 'all', but since the prefix nature of matchers
@@ -483,6 +483,14 @@
              or pycompat.byterepr(self.matchfn))
         return '<predicatenmatcher pred=%s>' % s
 
+def normalizerootdir(dir, funcname):
+    if dir == '.':
+        util.nouideprecwarn("match.%s() no longer accepts "
+                            "'.', use '' instead." % funcname, '5.1')
+        return ''
+    return dir
+
+
 class patternmatcher(basematcher):
     """Matches a set of (kind, pat, source) against a 'root' directory.
 
@@ -507,7 +515,7 @@
     True
 
     >>> m.files()
-    ['.', 'foo/a', 'b', '.']
+    ['', 'foo/a', 'b', '']
     >>> m.exact(b'foo/a')
     True
     >>> m.exact(b'b')
@@ -525,12 +533,13 @@
 
     @propertycache
     def _dirs(self):
-        return set(util.dirs(self._fileset)) | {'.'}
+        return set(util.dirs(self._fileset)) | {''}
 
     def visitdir(self, dir):
+        dir = normalizerootdir(dir, 'visitdir')
         if self._prefix and dir in self._fileset:
             return 'all'
-        return ('.' in self._fileset or
+        return ('' in self._fileset or
                 dir in self._fileset or
                 dir in self._dirs or
                 any(parentdir in self._fileset
@@ -564,7 +573,7 @@
             addpath(f)
 
     def addpath(self, path):
-        if path == '.':
+        if path == '':
             return
         dirs = self._dirs
         findsplitdirs = _dirchildren._findsplitdirs
@@ -580,14 +589,14 @@
         #  - produces a (dirname, basename) tuple, not just 'dirname'
         #  - includes root dir
         # Unlike manifest._splittopdir, this does not suffix `dirname` with a
-        # slash, and produces '.' for the root instead of ''.
+        # slash.
         oldpos = len(path)
         pos = path.rfind('/')
         while pos != -1:
             yield path[:pos], path[pos + 1:oldpos]
             oldpos = pos
             pos = path.rfind('/', 0, pos)
-        yield '.', path[:oldpos]
+        yield '', path[:oldpos]
 
     def get(self, path):
         return self._dirs.get(path, set())
@@ -609,9 +618,10 @@
         self._parents = set(parents)
 
     def visitdir(self, dir):
+        dir = normalizerootdir(dir, 'visitdir')
         if self._prefix and dir in self._roots:
             return 'all'
-        return ('.' in self._roots or
+        return ('' in self._roots or
                 dir in self._roots or
                 dir in self._dirs or
                 dir in self._parents or
@@ -635,7 +645,7 @@
             return 'all'
         # Note: this does *not* include the 'dir in self._parents' case from
         # visitdir, that's handled below.
-        if ('.' in self._roots or
+        if ('' in self._roots or
             dir in self._roots or
             dir in self._dirs or
             any(parentdir in self._roots
@@ -683,22 +693,25 @@
 
     @propertycache
     def _dirs(self):
-        return set(util.dirs(self._fileset)) | {'.'}
+        return set(util.dirs(self._fileset)) | {''}
 
     def visitdir(self, dir):
+        dir = normalizerootdir(dir, 'visitdir')
         return dir in self._dirs
 
     def visitchildrenset(self, dir):
+        dir = normalizerootdir(dir, 'visitchildrenset')
+
         if not self._fileset or dir not in self._dirs:
             return set()
 
-        candidates = self._fileset | self._dirs - {'.'}
-        if dir != '.':
+        candidates = self._fileset | self._dirs - {''}
+        if dir != '':
             d = dir + '/'
             candidates = set(c[len(d):] for c in candidates if
                              c.startswith(d))
         # self._dirs includes all of the directories, recursively, so if
-        # we're attempting to match foo/bar/baz.txt, it'll have '.', 'foo',
+        # we're attempting to match foo/bar/baz.txt, it'll have '', 'foo',
         # 'foo/bar' in it. Thus we can safely ignore a candidate that has a
         # '/' in it, indicating a it's for a subdir-of-a-subdir; the
         # immediate subdir will be in there without a slash.
@@ -772,7 +785,7 @@
         # Possible values for m1:         set(...), set()
         # Possible values for m2: 'this', set(...)
         # We ignore m2's set results. They're possibly incorrect:
-        #  m1 = path:dir/subdir, m2=rootfilesin:dir, visitchildrenset('.'):
+        #  m1 = path:dir/subdir, m2=rootfilesin:dir, visitchildrenset(''):
         #    m1 returns {'dir'}, m2 returns {'dir'}, if we subtracted we'd
         #    return set(), which is *not* correct, we still need to visit 'dir'!
         return m1_set
@@ -918,14 +931,16 @@
         return self._matcher.matchfn(self._path + "/" + f)
 
     def visitdir(self, dir):
-        if dir == '.':
+        dir = normalizerootdir(dir, 'visitdir')
+        if dir == '':
             dir = self._path
         else:
             dir = self._path + "/" + dir
         return self._matcher.visitdir(dir)
 
     def visitchildrenset(self, dir):
-        if dir == '.':
+        dir = normalizerootdir(dir, 'visitchildrenset')
+        if dir == '':
             dir = self._path
         else:
             dir = self._path + "/" + dir
@@ -994,18 +1009,18 @@
 
     @propertycache
     def _pathdirs(self):
-        return set(util.finddirs(self._path)) | {'.'}
+        return set(util.finddirs(self._path)) | {''}
 
     def visitdir(self, dir):
         if dir == self._path:
-            return self._matcher.visitdir('.')
+            return self._matcher.visitdir('')
         if dir.startswith(self._pathprefix):
             return self._matcher.visitdir(dir[len(self._pathprefix):])
         return dir in self._pathdirs
 
     def visitchildrenset(self, dir):
         if dir == self._path:
-            return self._matcher.visitchildrenset('.')
+            return self._matcher.visitchildrenset('')
         if dir.startswith(self._pathprefix):
             return self._matcher.visitchildrenset(dir[len(self._pathprefix):])
         if dir in self._pathdirs:
@@ -1197,7 +1212,7 @@
                 'not a regex pattern: %s:%s' % (kind, pat)
             )
 
-    if not pat:
+    if not pat and kind in ('glob', 'relpath'):
         return ''
     if kind == 're':
         return pat
@@ -1341,13 +1356,17 @@
                 if '[' in p or '{' in p or '*' in p or '?' in p:
                     break
                 root.append(p)
-            r.append('/'.join(root) or '.')
+            r.append('/'.join(root))
         elif kind in ('relpath', 'path'):
-            r.append(pat or '.')
+            if pat == '.':
+                pat = ''
+            r.append(pat)
         elif kind in ('rootfilesin',):
-            d.append(pat or '.')
+            if pat == '.':
+                pat = ''
+            d.append(pat)
         else: # relglob, re, relre
-            r.append('.')
+            r.append('')
     return r, d
 
 def _roots(kindpats):
@@ -1367,18 +1386,18 @@
     >>> _rootsdirsandparents(
     ...     [(b'glob', b'g/h/*', b''), (b'glob', b'g/h', b''),
     ...      (b'glob', b'g*', b'')])
-    (['g/h', 'g/h', '.'], [], ['g', '.'])
+    (['g/h', 'g/h', ''], [], ['g', ''])
     >>> _rootsdirsandparents(
     ...     [(b'rootfilesin', b'g/h', b''), (b'rootfilesin', b'', b'')])
-    ([], ['g/h', '.'], ['g', '.'])
+    ([], ['g/h', ''], ['g', ''])
     >>> _rootsdirsandparents(
     ...     [(b'relpath', b'r', b''), (b'path', b'p/p', b''),
     ...      (b'path', b'', b'')])
-    (['r', 'p/p', '.'], [], ['p', '.'])
+    (['r', 'p/p', ''], [], ['p', ''])
     >>> _rootsdirsandparents(
     ...     [(b'relglob', b'rg*', b''), (b're', b're/', b''),
     ...      (b'relre', b'rr', b'')])
-    (['.', '.', '.'], [], ['.'])
+    (['', '', ''], [], [''])
     '''
     r, d = _patternrootsanddirs(kindpats)
 
@@ -1388,7 +1407,7 @@
     p.extend(util.dirs(d))
     p.extend(util.dirs(r))
     # util.dirs() does not include the root directory, so add it manually
-    p.append('.')
+    p.append('')
 
     # FIXME: all uses of this function convert these to sets, do so before
     # returning.
--- a/mercurial/store.py	Wed Apr 24 09:32:29 2019 -0700
+++ b/mercurial/store.py	Mon May 15 00:12:19 2017 -0700
@@ -40,7 +40,7 @@
     if path.startswith('data/'):
         return matcher(path[len('data/'):-len('.i')])
     elif path.startswith('meta/'):
-        return matcher.visitdir(path[len('meta/'):-len('/00manifest.i')] or '.')
+        return matcher.visitdir(path[len('meta/'):-len('/00manifest.i')])
 
     raise error.ProgrammingError("cannot decode path %s" % path)
 
--- a/relnotes/next	Wed Apr 24 09:32:29 2019 -0700
+++ b/relnotes/next	Mon May 15 00:12:19 2017 -0700
@@ -29,3 +29,6 @@
 == Internal API Changes ==
 
  * Matchers are no longer iterable. Use `match.files()` instead.
+
+ * `match.visitdir()` and `match.visitchildrenset()` now expect the
+   empty string instead of '.' to indicate the root directory.
--- a/tests/test-match.py	Wed Apr 24 09:32:29 2019 -0700
+++ b/tests/test-match.py	Mon May 15 00:12:19 2017 -0700
@@ -13,36 +13,36 @@
 
     def testVisitdir(self):
         m = matchmod.basematcher()
-        self.assertTrue(m.visitdir(b'.'))
+        self.assertTrue(m.visitdir(b''))
         self.assertTrue(m.visitdir(b'dir'))
 
     def testVisitchildrenset(self):
         m = matchmod.basematcher()
-        self.assertEqual(m.visitchildrenset(b'.'), b'this')
+        self.assertEqual(m.visitchildrenset(b''), b'this')
         self.assertEqual(m.visitchildrenset(b'dir'), b'this')
 
 class AlwaysMatcherTests(unittest.TestCase):
 
     def testVisitdir(self):
         m = matchmod.alwaysmatcher()
-        self.assertEqual(m.visitdir(b'.'), b'all')
+        self.assertEqual(m.visitdir(b''), b'all')
         self.assertEqual(m.visitdir(b'dir'), b'all')
 
     def testVisitchildrenset(self):
         m = matchmod.alwaysmatcher()
-        self.assertEqual(m.visitchildrenset(b'.'), b'all')
+        self.assertEqual(m.visitchildrenset(b''), b'all')
         self.assertEqual(m.visitchildrenset(b'dir'), b'all')
 
 class NeverMatcherTests(unittest.TestCase):
 
     def testVisitdir(self):
         m = matchmod.nevermatcher()
-        self.assertFalse(m.visitdir(b'.'))
+        self.assertFalse(m.visitdir(b''))
         self.assertFalse(m.visitdir(b'dir'))
 
     def testVisitchildrenset(self):
         m = matchmod.nevermatcher()
-        self.assertEqual(m.visitchildrenset(b'.'), set())
+        self.assertEqual(m.visitchildrenset(b''), set())
         self.assertEqual(m.visitchildrenset(b'dir'), set())
 
 class PredicateMatcherTests(unittest.TestCase):
@@ -51,12 +51,12 @@
 
     def testVisitdir(self):
         m = matchmod.predicatematcher(lambda *a: False)
-        self.assertTrue(m.visitdir(b'.'))
+        self.assertTrue(m.visitdir(b''))
         self.assertTrue(m.visitdir(b'dir'))
 
     def testVisitchildrenset(self):
         m = matchmod.predicatematcher(lambda *a: False)
-        self.assertEqual(m.visitchildrenset(b'.'), b'this')
+        self.assertEqual(m.visitchildrenset(b''), b'this')
         self.assertEqual(m.visitchildrenset(b'dir'), b'this')
 
 class PatternMatcherTests(unittest.TestCase):
@@ -64,7 +64,7 @@
     def testVisitdirPrefix(self):
         m = matchmod.match(b'x', b'', patterns=[b'path:dir/subdir'])
         assert isinstance(m, matchmod.patternmatcher)
-        self.assertTrue(m.visitdir(b'.'))
+        self.assertTrue(m.visitdir(b''))
         self.assertTrue(m.visitdir(b'dir'))
         self.assertEqual(m.visitdir(b'dir/subdir'), b'all')
         # OPT: This should probably be 'all' if its parent is?
@@ -74,7 +74,7 @@
     def testVisitchildrensetPrefix(self):
         m = matchmod.match(b'x', b'', patterns=[b'path:dir/subdir'])
         assert isinstance(m, matchmod.patternmatcher)
-        self.assertEqual(m.visitchildrenset(b'.'), b'this')
+        self.assertEqual(m.visitchildrenset(b''), b'this')
         self.assertEqual(m.visitchildrenset(b'dir'), b'this')
         self.assertEqual(m.visitchildrenset(b'dir/subdir'), b'all')
         # OPT: This should probably be 'all' if its parent is?
@@ -84,7 +84,7 @@
     def testVisitdirRootfilesin(self):
         m = matchmod.match(b'x', b'', patterns=[b'rootfilesin:dir/subdir'])
         assert isinstance(m, matchmod.patternmatcher)
-        self.assertTrue(m.visitdir(b'.'))
+        self.assertTrue(m.visitdir(b''))
         self.assertFalse(m.visitdir(b'dir/subdir/x'))
         self.assertFalse(m.visitdir(b'folder'))
         # FIXME: These should probably be True.
@@ -94,7 +94,7 @@
     def testVisitchildrensetRootfilesin(self):
         m = matchmod.match(b'x', b'', patterns=[b'rootfilesin:dir/subdir'])
         assert isinstance(m, matchmod.patternmatcher)
-        self.assertEqual(m.visitchildrenset(b'.'), b'this')
+        self.assertEqual(m.visitchildrenset(b''), b'this')
         self.assertEqual(m.visitchildrenset(b'dir/subdir/x'), set())
         self.assertEqual(m.visitchildrenset(b'folder'), set())
         # FIXME: These should probably be {'subdir'} and 'this', respectively,
@@ -105,7 +105,7 @@
     def testVisitdirGlob(self):
         m = matchmod.match(b'x', b'', patterns=[b'glob:dir/z*'])
         assert isinstance(m, matchmod.patternmatcher)
-        self.assertTrue(m.visitdir(b'.'))
+        self.assertTrue(m.visitdir(b''))
         self.assertTrue(m.visitdir(b'dir'))
         self.assertFalse(m.visitdir(b'folder'))
         # OPT: these should probably be False.
@@ -115,7 +115,7 @@
     def testVisitchildrensetGlob(self):
         m = matchmod.match(b'x', b'', patterns=[b'glob:dir/z*'])
         assert isinstance(m, matchmod.patternmatcher)
-        self.assertEqual(m.visitchildrenset(b'.'), b'this')
+        self.assertEqual(m.visitchildrenset(b''), b'this')
         self.assertEqual(m.visitchildrenset(b'folder'), set())
         self.assertEqual(m.visitchildrenset(b'dir'), b'this')
         # OPT: these should probably be set().
@@ -127,7 +127,7 @@
     def testVisitdirPrefix(self):
         m = matchmod.match(b'x', b'', include=[b'path:dir/subdir'])
         assert isinstance(m, matchmod.includematcher)
-        self.assertTrue(m.visitdir(b'.'))
+        self.assertTrue(m.visitdir(b''))
         self.assertTrue(m.visitdir(b'dir'))
         self.assertEqual(m.visitdir(b'dir/subdir'), b'all')
         # OPT: This should probably be 'all' if its parent is?
@@ -137,7 +137,7 @@
     def testVisitchildrensetPrefix(self):
         m = matchmod.match(b'x', b'', include=[b'path:dir/subdir'])
         assert isinstance(m, matchmod.includematcher)
-        self.assertEqual(m.visitchildrenset(b'.'), {b'dir'})
+        self.assertEqual(m.visitchildrenset(b''), {b'dir'})
         self.assertEqual(m.visitchildrenset(b'dir'), {b'subdir'})
         self.assertEqual(m.visitchildrenset(b'dir/subdir'), b'all')
         # OPT: This should probably be 'all' if its parent is?
@@ -147,7 +147,7 @@
     def testVisitdirRootfilesin(self):
         m = matchmod.match(b'x', b'', include=[b'rootfilesin:dir/subdir'])
         assert isinstance(m, matchmod.includematcher)
-        self.assertTrue(m.visitdir(b'.'))
+        self.assertTrue(m.visitdir(b''))
         self.assertTrue(m.visitdir(b'dir'))
         self.assertTrue(m.visitdir(b'dir/subdir'))
         self.assertFalse(m.visitdir(b'dir/subdir/x'))
@@ -156,7 +156,7 @@
     def testVisitchildrensetRootfilesin(self):
         m = matchmod.match(b'x', b'', include=[b'rootfilesin:dir/subdir'])
         assert isinstance(m, matchmod.includematcher)
-        self.assertEqual(m.visitchildrenset(b'.'), {b'dir'})
+        self.assertEqual(m.visitchildrenset(b''), {b'dir'})
         self.assertEqual(m.visitchildrenset(b'dir'), {b'subdir'})
         self.assertEqual(m.visitchildrenset(b'dir/subdir'), b'this')
         self.assertEqual(m.visitchildrenset(b'dir/subdir/x'), set())
@@ -165,7 +165,7 @@
     def testVisitdirGlob(self):
         m = matchmod.match(b'x', b'', include=[b'glob:dir/z*'])
         assert isinstance(m, matchmod.includematcher)
-        self.assertTrue(m.visitdir(b'.'))
+        self.assertTrue(m.visitdir(b''))
         self.assertTrue(m.visitdir(b'dir'))
         self.assertFalse(m.visitdir(b'folder'))
         # OPT: these should probably be False.
@@ -175,7 +175,7 @@
     def testVisitchildrensetGlob(self):
         m = matchmod.match(b'x', b'', include=[b'glob:dir/z*'])
         assert isinstance(m, matchmod.includematcher)
-        self.assertEqual(m.visitchildrenset(b'.'), {b'dir'})
+        self.assertEqual(m.visitchildrenset(b''), {b'dir'})
         self.assertEqual(m.visitchildrenset(b'folder'), set())
         self.assertEqual(m.visitchildrenset(b'dir'), b'this')
         # OPT: these should probably be set().
@@ -187,7 +187,7 @@
     def testVisitdir(self):
         m = matchmod.exact(files=[b'dir/subdir/foo.txt'])
         assert isinstance(m, matchmod.exactmatcher)
-        self.assertTrue(m.visitdir(b'.'))
+        self.assertTrue(m.visitdir(b''))
         self.assertTrue(m.visitdir(b'dir'))
         self.assertTrue(m.visitdir(b'dir/subdir'))
         self.assertFalse(m.visitdir(b'dir/subdir/foo.txt'))
@@ -198,7 +198,7 @@
     def testVisitchildrenset(self):
         m = matchmod.exact(files=[b'dir/subdir/foo.txt'])
         assert isinstance(m, matchmod.exactmatcher)
-        self.assertEqual(m.visitchildrenset(b'.'), {b'dir'})
+        self.assertEqual(m.visitchildrenset(b''), {b'dir'})
         self.assertEqual(m.visitchildrenset(b'dir'), {b'subdir'})
         self.assertEqual(m.visitchildrenset(b'dir/subdir'), {b'foo.txt'})
         self.assertEqual(m.visitchildrenset(b'dir/subdir/x'), set())
@@ -212,7 +212,7 @@
                                   # no file in a/b/c
                                   b'a/b/c/d/file4.txt'])
         assert isinstance(m, matchmod.exactmatcher)
-        self.assertEqual(m.visitchildrenset(b'.'), {b'a', b'rootfile.txt'})
+        self.assertEqual(m.visitchildrenset(b''), {b'a', b'rootfile.txt'})
         self.assertEqual(m.visitchildrenset(b'a'), {b'b', b'file1.txt'})
         self.assertEqual(m.visitchildrenset(b'a/b'), {b'c', b'file2.txt'})
         self.assertEqual(m.visitchildrenset(b'a/b/c'), {b'd'})
@@ -227,7 +227,7 @@
         m2 = matchmod.alwaysmatcher()
         dm = matchmod.differencematcher(m1, m2)
         # dm should be equivalent to a nevermatcher.
-        self.assertFalse(dm.visitdir(b'.'))
+        self.assertFalse(dm.visitdir(b''))
         self.assertFalse(dm.visitdir(b'dir'))
         self.assertFalse(dm.visitdir(b'dir/subdir'))
         self.assertFalse(dm.visitdir(b'dir/subdir/z'))
@@ -240,7 +240,7 @@
         m2 = matchmod.alwaysmatcher()
         dm = matchmod.differencematcher(m1, m2)
         # dm should be equivalent to a nevermatcher.
-        self.assertEqual(dm.visitchildrenset(b'.'), set())
+        self.assertEqual(dm.visitchildrenset(b''), set())
         self.assertEqual(dm.visitchildrenset(b'dir'), set())
         self.assertEqual(dm.visitchildrenset(b'dir/subdir'), set())
         self.assertEqual(dm.visitchildrenset(b'dir/subdir/z'), set())
@@ -258,7 +258,7 @@
         # assertTrue does NOT verify that it's a bool, just that it's truthy.
         # While we may want to eventually make these return 'all', they should
         # not currently do so.
-        self.assertEqual(dm.visitdir(b'.'), b'all')
+        self.assertEqual(dm.visitdir(b''), b'all')
         self.assertEqual(dm.visitdir(b'dir'), b'all')
         self.assertEqual(dm.visitdir(b'dir/subdir'), b'all')
         self.assertEqual(dm.visitdir(b'dir/subdir/z'), b'all')
@@ -271,7 +271,7 @@
         m2 = matchmod.nevermatcher()
         dm = matchmod.differencematcher(m1, m2)
         # dm should be equivalent to a alwaysmatcher.
-        self.assertEqual(dm.visitchildrenset(b'.'), b'all')
+        self.assertEqual(dm.visitchildrenset(b''), b'all')
         self.assertEqual(dm.visitchildrenset(b'dir'), b'all')
         self.assertEqual(dm.visitchildrenset(b'dir/subdir'), b'all')
         self.assertEqual(dm.visitchildrenset(b'dir/subdir/z'), b'all')
@@ -283,7 +283,7 @@
         m1 = matchmod.alwaysmatcher()
         m2 = matchmod.match(b'', b'', patterns=[b'path:dir/subdir'])
         dm = matchmod.differencematcher(m1, m2)
-        self.assertEqual(dm.visitdir(b'.'), True)
+        self.assertEqual(dm.visitdir(b''), True)
         self.assertEqual(dm.visitdir(b'dir'), True)
         self.assertFalse(dm.visitdir(b'dir/subdir'))
         # OPT: We should probably return False for these; we don't because
@@ -298,7 +298,7 @@
         m1 = matchmod.alwaysmatcher()
         m2 = matchmod.match(b'', b'', patterns=[b'path:dir/subdir'])
         dm = matchmod.differencematcher(m1, m2)
-        self.assertEqual(dm.visitchildrenset(b'.'), b'this')
+        self.assertEqual(dm.visitchildrenset(b''), b'this')
         self.assertEqual(dm.visitchildrenset(b'dir'), b'this')
         self.assertEqual(dm.visitchildrenset(b'dir/subdir'), set())
         self.assertEqual(dm.visitchildrenset(b'dir/foo'), b'all')
@@ -315,7 +315,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         m2 = matchmod.match(b'', b'', include=[b'rootfilesin:dir'])
         dm = matchmod.differencematcher(m1, m2)
-        self.assertEqual(dm.visitdir(b'.'), True)
+        self.assertEqual(dm.visitdir(b''), True)
         self.assertEqual(dm.visitdir(b'dir'), True)
         self.assertEqual(dm.visitdir(b'dir/subdir'), b'all')
         self.assertFalse(dm.visitdir(b'dir/foo'))
@@ -330,7 +330,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         m2 = matchmod.match(b'', b'', include=[b'rootfilesin:dir'])
         dm = matchmod.differencematcher(m1, m2)
-        self.assertEqual(dm.visitchildrenset(b'.'), {b'dir'})
+        self.assertEqual(dm.visitchildrenset(b''), {b'dir'})
         self.assertEqual(dm.visitchildrenset(b'dir'), {b'subdir'})
         self.assertEqual(dm.visitchildrenset(b'dir/subdir'), b'all')
         self.assertEqual(dm.visitchildrenset(b'dir/foo'), set())
@@ -348,7 +348,7 @@
         m2 = matchmod.alwaysmatcher()
         im = matchmod.intersectmatchers(m1, m2)
         # im should be equivalent to a alwaysmatcher.
-        self.assertEqual(im.visitdir(b'.'), b'all')
+        self.assertEqual(im.visitdir(b''), b'all')
         self.assertEqual(im.visitdir(b'dir'), b'all')
         self.assertEqual(im.visitdir(b'dir/subdir'), b'all')
         self.assertEqual(im.visitdir(b'dir/subdir/z'), b'all')
@@ -361,7 +361,7 @@
         m2 = matchmod.alwaysmatcher()
         im = matchmod.intersectmatchers(m1, m2)
         # im should be equivalent to a alwaysmatcher.
-        self.assertEqual(im.visitchildrenset(b'.'), b'all')
+        self.assertEqual(im.visitchildrenset(b''), b'all')
         self.assertEqual(im.visitchildrenset(b'dir'), b'all')
         self.assertEqual(im.visitchildrenset(b'dir/subdir'), b'all')
         self.assertEqual(im.visitchildrenset(b'dir/subdir/z'), b'all')
@@ -374,7 +374,7 @@
         m2 = matchmod.nevermatcher()
         im = matchmod.intersectmatchers(m1, m2)
         # im should be equivalent to a nevermatcher.
-        self.assertFalse(im.visitdir(b'.'))
+        self.assertFalse(im.visitdir(b''))
         self.assertFalse(im.visitdir(b'dir'))
         self.assertFalse(im.visitdir(b'dir/subdir'))
         self.assertFalse(im.visitdir(b'dir/subdir/z'))
@@ -387,7 +387,7 @@
         m2 = matchmod.nevermatcher()
         im = matchmod.intersectmatchers(m1, m2)
         # im should be equivalent to a nevermqtcher.
-        self.assertEqual(im.visitchildrenset(b'.'), set())
+        self.assertEqual(im.visitchildrenset(b''), set())
         self.assertEqual(im.visitchildrenset(b'dir'), set())
         self.assertEqual(im.visitchildrenset(b'dir/subdir'), set())
         self.assertEqual(im.visitchildrenset(b'dir/subdir/z'), set())
@@ -399,7 +399,7 @@
         m1 = matchmod.alwaysmatcher()
         m2 = matchmod.match(b'', b'', patterns=[b'path:dir/subdir'])
         im = matchmod.intersectmatchers(m1, m2)
-        self.assertEqual(im.visitdir(b'.'), True)
+        self.assertEqual(im.visitdir(b''), True)
         self.assertEqual(im.visitdir(b'dir'), True)
         self.assertEqual(im.visitdir(b'dir/subdir'), b'all')
         self.assertFalse(im.visitdir(b'dir/foo'))
@@ -414,7 +414,7 @@
         m1 = matchmod.alwaysmatcher()
         m2 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         im = matchmod.intersectmatchers(m1, m2)
-        self.assertEqual(im.visitchildrenset(b'.'), {b'dir'})
+        self.assertEqual(im.visitchildrenset(b''), {b'dir'})
         self.assertEqual(im.visitchildrenset(b'dir'), {b'subdir'})
         self.assertEqual(im.visitchildrenset(b'dir/subdir'), b'all')
         self.assertEqual(im.visitchildrenset(b'dir/foo'), set())
@@ -429,7 +429,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         m2 = matchmod.match(b'', b'', include=[b'rootfilesin:dir'])
         im = matchmod.intersectmatchers(m1, m2)
-        self.assertEqual(im.visitdir(b'.'), True)
+        self.assertEqual(im.visitdir(b''), True)
         self.assertEqual(im.visitdir(b'dir'), True)
         self.assertFalse(im.visitdir(b'dir/subdir'))
         self.assertFalse(im.visitdir(b'dir/foo'))
@@ -441,7 +441,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         m2 = matchmod.match(b'', b'', include=[b'rootfilesin:dir'])
         im = matchmod.intersectmatchers(m1, m2)
-        self.assertEqual(im.visitchildrenset(b'.'), {b'dir'})
+        self.assertEqual(im.visitchildrenset(b''), {b'dir'})
         self.assertEqual(im.visitchildrenset(b'dir'), b'this')
         self.assertEqual(im.visitchildrenset(b'dir/subdir'), set())
         self.assertEqual(im.visitchildrenset(b'dir/foo'), set())
@@ -456,7 +456,7 @@
         m2 = matchmod.match(b'', b'', include=[b'path:folder'])
         im = matchmod.intersectmatchers(m1, m2)
         # FIXME: is True correct here?
-        self.assertEqual(im.visitdir(b'.'), True)
+        self.assertEqual(im.visitdir(b''), True)
         self.assertFalse(im.visitdir(b'dir'))
         self.assertFalse(im.visitdir(b'dir/subdir'))
         self.assertFalse(im.visitdir(b'dir/foo'))
@@ -469,7 +469,7 @@
         m2 = matchmod.match(b'', b'', include=[b'path:folder'])
         im = matchmod.intersectmatchers(m1, m2)
         # FIXME: is set() correct here?
-        self.assertEqual(im.visitchildrenset(b'.'), set())
+        self.assertEqual(im.visitchildrenset(b''), set())
         self.assertEqual(im.visitchildrenset(b'dir'), set())
         self.assertEqual(im.visitchildrenset(b'dir/subdir'), set())
         self.assertEqual(im.visitchildrenset(b'dir/foo'), set())
@@ -483,7 +483,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir/x'])
         m2 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         im = matchmod.intersectmatchers(m1, m2)
-        self.assertEqual(im.visitdir(b'.'), True)
+        self.assertEqual(im.visitdir(b''), True)
         self.assertEqual(im.visitdir(b'dir'), True)
         self.assertEqual(im.visitdir(b'dir/subdir'), True)
         self.assertFalse(im.visitdir(b'dir/foo'))
@@ -496,7 +496,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir/x'])
         m2 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         im = matchmod.intersectmatchers(m1, m2)
-        self.assertEqual(im.visitchildrenset(b'.'), {b'dir'})
+        self.assertEqual(im.visitchildrenset(b''), {b'dir'})
         self.assertEqual(im.visitchildrenset(b'dir'), {b'subdir'})
         self.assertEqual(im.visitchildrenset(b'dir/subdir'), {b'x'})
         self.assertEqual(im.visitchildrenset(b'dir/foo'), set())
@@ -512,7 +512,7 @@
         m2 = matchmod.match(b'', b'', include=[b'path:dir/subdir/z'])
         im = matchmod.intersectmatchers(m1, m2)
         # OPT: these next three could probably be False as well.
-        self.assertEqual(im.visitdir(b'.'), True)
+        self.assertEqual(im.visitdir(b''), True)
         self.assertEqual(im.visitdir(b'dir'), True)
         self.assertEqual(im.visitdir(b'dir/subdir'), True)
         self.assertFalse(im.visitdir(b'dir/foo'))
@@ -525,7 +525,7 @@
         m2 = matchmod.match(b'', b'', include=[b'path:dir/subdir/z'])
         im = matchmod.intersectmatchers(m1, m2)
         # OPT: these next two could probably be set() as well.
-        self.assertEqual(im.visitchildrenset(b'.'), {b'dir'})
+        self.assertEqual(im.visitchildrenset(b''), {b'dir'})
         self.assertEqual(im.visitchildrenset(b'dir'), {b'subdir'})
         self.assertEqual(im.visitchildrenset(b'dir/subdir'), set())
         self.assertEqual(im.visitchildrenset(b'dir/foo'), set())
@@ -540,7 +540,7 @@
         m2 = matchmod.alwaysmatcher()
         um = matchmod.unionmatcher([m1, m2])
         # um should be equivalent to a alwaysmatcher.
-        self.assertEqual(um.visitdir(b'.'), b'all')
+        self.assertEqual(um.visitdir(b''), b'all')
         self.assertEqual(um.visitdir(b'dir'), b'all')
         self.assertEqual(um.visitdir(b'dir/subdir'), b'all')
         self.assertEqual(um.visitdir(b'dir/subdir/z'), b'all')
@@ -553,7 +553,7 @@
         m2 = matchmod.alwaysmatcher()
         um = matchmod.unionmatcher([m1, m2])
         # um should be equivalent to a alwaysmatcher.
-        self.assertEqual(um.visitchildrenset(b'.'), b'all')
+        self.assertEqual(um.visitchildrenset(b''), b'all')
         self.assertEqual(um.visitchildrenset(b'dir'), b'all')
         self.assertEqual(um.visitchildrenset(b'dir/subdir'), b'all')
         self.assertEqual(um.visitchildrenset(b'dir/subdir/z'), b'all')
@@ -566,7 +566,7 @@
         m2 = matchmod.alwaysmatcher()
         um = matchmod.unionmatcher([m1, m2])
         # um should be equivalent to a alwaysmatcher.
-        self.assertEqual(um.visitdir(b'.'), b'all')
+        self.assertEqual(um.visitdir(b''), b'all')
         self.assertEqual(um.visitdir(b'dir'), b'all')
         self.assertEqual(um.visitdir(b'dir/subdir'), b'all')
         self.assertEqual(um.visitdir(b'dir/subdir/z'), b'all')
@@ -579,7 +579,7 @@
         m2 = matchmod.alwaysmatcher()
         um = matchmod.unionmatcher([m1, m2])
         # um should be equivalent to a alwaysmatcher.
-        self.assertEqual(um.visitchildrenset(b'.'), b'all')
+        self.assertEqual(um.visitchildrenset(b''), b'all')
         self.assertEqual(um.visitchildrenset(b'dir'), b'all')
         self.assertEqual(um.visitchildrenset(b'dir/subdir'), b'all')
         self.assertEqual(um.visitchildrenset(b'dir/subdir/z'), b'all')
@@ -592,7 +592,7 @@
         m2 = matchmod.nevermatcher()
         um = matchmod.unionmatcher([m1, m2])
         # um should be equivalent to a alwaysmatcher.
-        self.assertEqual(um.visitdir(b'.'), b'all')
+        self.assertEqual(um.visitdir(b''), b'all')
         self.assertEqual(um.visitdir(b'dir'), b'all')
         self.assertEqual(um.visitdir(b'dir/subdir'), b'all')
         self.assertEqual(um.visitdir(b'dir/subdir/z'), b'all')
@@ -605,7 +605,7 @@
         m2 = matchmod.nevermatcher()
         um = matchmod.unionmatcher([m1, m2])
         # um should be equivalent to a alwaysmatcher.
-        self.assertEqual(um.visitchildrenset(b'.'), b'all')
+        self.assertEqual(um.visitchildrenset(b''), b'all')
         self.assertEqual(um.visitchildrenset(b'dir'), b'all')
         self.assertEqual(um.visitchildrenset(b'dir/subdir'), b'all')
         self.assertEqual(um.visitchildrenset(b'dir/subdir/z'), b'all')
@@ -617,7 +617,7 @@
         m1 = matchmod.alwaysmatcher()
         m2 = matchmod.match(b'', b'', patterns=[b'path:dir/subdir'])
         um = matchmod.unionmatcher([m1, m2])
-        self.assertEqual(um.visitdir(b'.'), b'all')
+        self.assertEqual(um.visitdir(b''), b'all')
         self.assertEqual(um.visitdir(b'dir'), b'all')
         self.assertEqual(um.visitdir(b'dir/subdir'), b'all')
         self.assertEqual(um.visitdir(b'dir/foo'), b'all')
@@ -629,7 +629,7 @@
         m1 = matchmod.alwaysmatcher()
         m2 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         um = matchmod.unionmatcher([m1, m2])
-        self.assertEqual(um.visitchildrenset(b'.'), b'all')
+        self.assertEqual(um.visitchildrenset(b''), b'all')
         self.assertEqual(um.visitchildrenset(b'dir'), b'all')
         self.assertEqual(um.visitchildrenset(b'dir/subdir'), b'all')
         self.assertEqual(um.visitchildrenset(b'dir/foo'), b'all')
@@ -643,7 +643,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         m2 = matchmod.match(b'', b'', include=[b'rootfilesin:dir'])
         um = matchmod.unionmatcher([m1, m2])
-        self.assertEqual(um.visitdir(b'.'), True)
+        self.assertEqual(um.visitdir(b''), True)
         self.assertEqual(um.visitdir(b'dir'), True)
         self.assertEqual(um.visitdir(b'dir/subdir'), b'all')
         self.assertFalse(um.visitdir(b'dir/foo'))
@@ -656,7 +656,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         m2 = matchmod.match(b'', b'', include=[b'rootfilesin:dir'])
         um = matchmod.unionmatcher([m1, m2])
-        self.assertEqual(um.visitchildrenset(b'.'), {b'dir'})
+        self.assertEqual(um.visitchildrenset(b''), {b'dir'})
         self.assertEqual(um.visitchildrenset(b'dir'), b'this')
         self.assertEqual(um.visitchildrenset(b'dir/subdir'), b'all')
         self.assertEqual(um.visitchildrenset(b'dir/foo'), set())
@@ -671,7 +671,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         m2 = matchmod.match(b'', b'', include=[b'path:folder'])
         um = matchmod.unionmatcher([m1, m2])
-        self.assertEqual(um.visitdir(b'.'), True)
+        self.assertEqual(um.visitdir(b''), True)
         self.assertEqual(um.visitdir(b'dir'), True)
         self.assertEqual(um.visitdir(b'dir/subdir'), b'all')
         self.assertFalse(um.visitdir(b'dir/foo'))
@@ -684,7 +684,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         m2 = matchmod.match(b'', b'', include=[b'path:folder'])
         um = matchmod.unionmatcher([m1, m2])
-        self.assertEqual(um.visitchildrenset(b'.'), {b'folder', b'dir'})
+        self.assertEqual(um.visitchildrenset(b''), {b'folder', b'dir'})
         self.assertEqual(um.visitchildrenset(b'dir'), {b'subdir'})
         self.assertEqual(um.visitchildrenset(b'dir/subdir'), b'all')
         self.assertEqual(um.visitchildrenset(b'dir/foo'), set())
@@ -699,7 +699,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir/x'])
         m2 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         um = matchmod.unionmatcher([m1, m2])
-        self.assertEqual(um.visitdir(b'.'), True)
+        self.assertEqual(um.visitdir(b''), True)
         self.assertEqual(um.visitdir(b'dir'), True)
         self.assertEqual(um.visitdir(b'dir/subdir'), b'all')
         self.assertFalse(um.visitdir(b'dir/foo'))
@@ -712,7 +712,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir/x'])
         m2 = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         um = matchmod.unionmatcher([m1, m2])
-        self.assertEqual(um.visitchildrenset(b'.'), {b'dir'})
+        self.assertEqual(um.visitchildrenset(b''), {b'dir'})
         self.assertEqual(um.visitchildrenset(b'dir'), {b'subdir'})
         self.assertEqual(um.visitchildrenset(b'dir/subdir'), b'all')
         self.assertEqual(um.visitchildrenset(b'dir/foo'), set())
@@ -728,7 +728,7 @@
         m2 = matchmod.match(b'', b'', include=[b'path:dir/subdir/z'])
         um = matchmod.unionmatcher([m1, m2])
         # OPT: these next three could probably be False as well.
-        self.assertEqual(um.visitdir(b'.'), True)
+        self.assertEqual(um.visitdir(b''), True)
         self.assertEqual(um.visitdir(b'dir'), True)
         self.assertEqual(um.visitdir(b'dir/subdir'), True)
         self.assertFalse(um.visitdir(b'dir/foo'))
@@ -740,7 +740,7 @@
         m1 = matchmod.match(b'', b'', include=[b'path:dir/subdir/x'])
         m2 = matchmod.match(b'', b'', include=[b'path:dir/subdir/z'])
         um = matchmod.unionmatcher([m1, m2])
-        self.assertEqual(um.visitchildrenset(b'.'), {b'dir'})
+        self.assertEqual(um.visitchildrenset(b''), {b'dir'})
         self.assertEqual(um.visitchildrenset(b'dir'), {b'subdir'})
         self.assertEqual(um.visitchildrenset(b'dir/subdir'), {b'x', b'z'})
         self.assertEqual(um.visitchildrenset(b'dir/foo'), set())
@@ -754,7 +754,7 @@
         m = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         sm = matchmod.subdirmatcher(b'dir', m)
 
-        self.assertEqual(sm.visitdir(b'.'), True)
+        self.assertEqual(sm.visitdir(b''), True)
         self.assertEqual(sm.visitdir(b'subdir'), b'all')
         # OPT: These next two should probably be 'all' not True.
         self.assertEqual(sm.visitdir(b'subdir/x'), True)
@@ -765,7 +765,7 @@
         m = matchmod.match(b'', b'', include=[b'path:dir/subdir'])
         sm = matchmod.subdirmatcher(b'dir', m)
 
-        self.assertEqual(sm.visitchildrenset(b'.'), {b'subdir'})
+        self.assertEqual(sm.visitchildrenset(b''), {b'subdir'})
         self.assertEqual(sm.visitchildrenset(b'subdir'), b'all')
         # OPT: These next two should probably be 'all' not 'this'.
         self.assertEqual(sm.visitchildrenset(b'subdir/x'), b'this')
@@ -795,12 +795,12 @@
         self.assertEqual(bool(pm(b'd/e/b.txt')), False)
         self.assertEqual(bool(pm(b'd/e/f/b.txt')), True)
 
-        self.assertEqual(m.visitdir(b'.'), True)
+        self.assertEqual(m.visitdir(b''), True)
         self.assertEqual(m.visitdir(b'e'), True)
         self.assertEqual(m.visitdir(b'e/f'), True)
         self.assertEqual(m.visitdir(b'e/f/g'), False)
 
-        self.assertEqual(pm.visitdir(b'.'), True)
+        self.assertEqual(pm.visitdir(b''), True)
         self.assertEqual(pm.visitdir(b'd'), True)
         self.assertEqual(pm.visitdir(b'd/e'), True)
         self.assertEqual(pm.visitdir(b'd/e/f'), True)
@@ -814,7 +814,7 @@
         # OPT: visitchildrenset could possibly return {'e'} and {'f'} for these
         # next two, respectively; patternmatcher does not have this
         # optimization.
-        self.assertEqual(m.visitchildrenset(b'.'), b'this')
+        self.assertEqual(m.visitchildrenset(b''), b'this')
         self.assertEqual(m.visitchildrenset(b'e'), b'this')
         self.assertEqual(m.visitchildrenset(b'e/f'), b'this')
         self.assertEqual(m.visitchildrenset(b'e/f/g'), set())
@@ -822,7 +822,7 @@
         # OPT: visitchildrenset could possibly return {'d'}, {'e'}, and {'f'}
         # for these next three, respectively; patternmatcher does not have this
         # optimization.
-        self.assertEqual(pm.visitchildrenset(b'.'), b'this')
+        self.assertEqual(pm.visitchildrenset(b''), b'this')
         self.assertEqual(pm.visitchildrenset(b'd'), b'this')
         self.assertEqual(pm.visitchildrenset(b'd/e'), b'this')
         self.assertEqual(pm.visitchildrenset(b'd/e/f'), b'this')