diff mercurial/sparse.py @ 35742:7a1806e0daea

sparse: --include 'dir1/dir2' should not include 'dir1/*' In 2015 there was a workaround added (f39bace2d6cad32907c0d7961b3c0dbd64a1b7ad) to sparse in the hg-experimental repo. That workaround: a) no longer seems to be needed, since its testcase passes even with the code removed, and b) caused a new problem: --include 'dir1/dir2' ended up including dir1/* too. (--include 'glob:dir1/dir2' is a user-level workaround.) Remove the offending code, and add a testcase for situation B.
author Hollis Blanchard <hollis_blanchard@mentor.com>
date Thu, 18 Jan 2018 13:33:21 -0800
parents 72b91f905065
children 6ef94f24aa82
line wrap: on
line diff
--- a/mercurial/sparse.py	Sun Jan 14 13:29:15 2018 +0900
+++ b/mercurial/sparse.py	Thu Jan 18 13:33:21 2018 -0800
@@ -294,24 +294,9 @@
             includes, excludes, profiles = patternsforrev(repo, rev)
 
             if includes or excludes:
-                # Explicitly include subdirectories of includes so
-                # status will walk them down to the actual include.
-                subdirs = set()
-                for include in includes:
-                    # TODO consider using posix path functions here so Windows
-                    # \ directory separators don't come into play.
-                    dirname = os.path.dirname(include)
-                    # basename is used to avoid issues with absolute
-                    # paths (which on Windows can include the drive).
-                    while os.path.basename(dirname):
-                        subdirs.add(dirname)
-                        dirname = os.path.dirname(dirname)
-
                 matcher = matchmod.match(repo.root, '', [],
                                          include=includes, exclude=excludes,
                                          default='relpath')
-                if subdirs:
-                    matcher = forceincludematcher(matcher, subdirs)
                 matchers.append(matcher)
         except IOError:
             pass