Patchwork D6406: match: drop unnecessary adding of '' to set of dirs

login
register
mail settings
Submitter phabricator
Date May 20, 2019, 3:48 p.m.
Message ID <b341088251e23c4d824e0b6fea5d30d6@localhost.localdomain>
Download mbox | patch
Permalink /patch/40153/
State Not Applicable
Headers show

Comments

phabricator - May 20, 2019, 3:48 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG38d85ec06552: match: drop unnecessary adding of &#039;&#039; to set of dirs (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6406?vs=15178&id=15198

REVISION DETAIL
  https://phab.mercurial-scm.org/D6406

AFFECTED FILES
  mercurial/match.py
  tests/test-match.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-match.py b/tests/test-match.py
--- a/tests/test-match.py
+++ b/tests/test-match.py
@@ -84,21 +84,21 @@ 
     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.assertFalse(m.visitdir(b'dir/subdir/x'))
         self.assertFalse(m.visitdir(b'folder'))
         # FIXME: These should probably be True.
+        self.assertFalse(m.visitdir(b''))
         self.assertFalse(m.visitdir(b'dir'))
         self.assertFalse(m.visitdir(b'dir/subdir'))
 
     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'dir/subdir/x'), set())
         self.assertEqual(m.visitchildrenset(b'folder'), set())
-        # FIXME: These should probably be {'subdir'} and 'this', respectively,
-        # or at least 'this' and 'this'.
+        # FIXME: These should probably be {'dir'}, {'subdir'} and 'this',
+        # respectively, or at least 'this' for all three.
+        self.assertEqual(m.visitchildrenset(b''), set())
         self.assertEqual(m.visitchildrenset(b'dir'), set())
         self.assertEqual(m.visitchildrenset(b'dir/subdir'), set())
 
diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -533,7 +533,7 @@ 
 
     @propertycache
     def _dirs(self):
-        return set(util.dirs(self._fileset)) | {''}
+        return set(util.dirs(self._fileset))
 
     def visitdir(self, dir):
         dir = normalizerootdir(dir, 'visitdir')
@@ -691,7 +691,7 @@ 
 
     @propertycache
     def _dirs(self):
-        return set(util.dirs(self._fileset)) | {''}
+        return set(util.dirs(self._fileset))
 
     def visitdir(self, dir):
         dir = normalizerootdir(dir, 'visitdir')
@@ -1007,7 +1007,7 @@ 
 
     @propertycache
     def _pathdirs(self):
-        return set(util.finddirs(self._path)) | {''}
+        return set(util.finddirs(self._path))
 
     def visitdir(self, dir):
         if dir == self._path: