mercurial/sparse.py
changeset 35742 7a1806e0daea
parent 35582 72b91f905065
child 37576 6ef94f24aa82
equal deleted inserted replaced
35741:73432eee0ac4 35742:7a1806e0daea
   292     for rev in revs:
   292     for rev in revs:
   293         try:
   293         try:
   294             includes, excludes, profiles = patternsforrev(repo, rev)
   294             includes, excludes, profiles = patternsforrev(repo, rev)
   295 
   295 
   296             if includes or excludes:
   296             if includes or excludes:
   297                 # Explicitly include subdirectories of includes so
       
   298                 # status will walk them down to the actual include.
       
   299                 subdirs = set()
       
   300                 for include in includes:
       
   301                     # TODO consider using posix path functions here so Windows
       
   302                     # \ directory separators don't come into play.
       
   303                     dirname = os.path.dirname(include)
       
   304                     # basename is used to avoid issues with absolute
       
   305                     # paths (which on Windows can include the drive).
       
   306                     while os.path.basename(dirname):
       
   307                         subdirs.add(dirname)
       
   308                         dirname = os.path.dirname(dirname)
       
   309 
       
   310                 matcher = matchmod.match(repo.root, '', [],
   297                 matcher = matchmod.match(repo.root, '', [],
   311                                          include=includes, exclude=excludes,
   298                                          include=includes, exclude=excludes,
   312                                          default='relpath')
   299                                          default='relpath')
   313                 if subdirs:
       
   314                     matcher = forceincludematcher(matcher, subdirs)
       
   315                 matchers.append(matcher)
   300                 matchers.append(matcher)
   316         except IOError:
   301         except IOError:
   317             pass
   302             pass
   318 
   303 
   319     if not matchers:
   304     if not matchers: