[PATCH 1 of 5] match: drop unnecessary removal of '.' from excluded roots

Martin von Zweigbergk martinvonz at google.com
Mon Jun 15 17:13:50 UTC 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1432758215 25200
#      Wed May 27 13:23:35 2015 -0700
# Node ID 66aff803f226fdf9cda773a195df02a676266fec
# Parent  2b2108c35bfca8d553602b8e3f765f36b2c97a41
match: drop unnecessary removal of '.' from excluded roots

The repo root is nothing special when it comes to what directories to
visit: patterns like '-X relglob:*.py' should not exclude the top
directory, while '-X path:.' should (pointless as such a pattern may
be). The explicit removal of '.' from the set of excluded roots was
probably there to avoid removing the the root directory when any
patterns had been given, but since 20ad936ac5d2 (treemanifest: visit
directory 'foo' when given e.g. '-X foo/ba?', 2015-05-27), we only
exclude directories that should be completely excluded, so we no
longer need to special-case the root directory.

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -135,7 +135,6 @@
                                               listsubrepos, root)
             if not _anypats(kindpats):
                 self._excluderoots.update(_roots(kindpats))
-                self._excluderoots.discard('.')
             matchfns.append(lambda f: not em(f))
         if exact:
             if isinstance(patterns, list):


More information about the Mercurial-devel mailing list