mirror of
https://github.com/facebook/sapling.git
synced 2024-12-27 23:22:02 +03:00
Fix status on files in included subdirs
Summary: There was a bug where if you included 'dir1/dir2/' in your sparse checkout, then status would not show newly added files in that directory. The problem is that dir1 is considered ignored, so the status walker would not walk down dir1. The fix is to explicitly match subdirectories of specified include patterns. Test Plan: Added a test Reviewers: pyd, rmcelroy, lcharignon, sid0 Reviewed By: sid0 Differential Revision: https://phabricator.fb.com/D2021037 Tasks: 6773875 Signature: t1:2021037:1429899282:3e305afa9ed395473dbe11d80abc43becb9eaa4a
This commit is contained in:
parent
3bc673a16b
commit
5cd2a69ed5
16
sparse.py
16
sparse.py
@ -368,9 +368,21 @@ def _wraprepo(ui, repo):
|
||||
includes, excludes, profiles = self.getsparsepatterns(rev)
|
||||
|
||||
if includes or excludes:
|
||||
matchers.append(matchmod.match(self.root, '', [],
|
||||
# Explicitly include subdirectories of includes so
|
||||
# status will walk them down to the actual include.
|
||||
subdirs = set()
|
||||
for include in includes:
|
||||
dirname = os.path.dirname(include)
|
||||
while dirname:
|
||||
subdirs.add(dirname)
|
||||
dirname = os.path.dirname(dirname)
|
||||
|
||||
matcher = matchmod.match(self.root, '', [],
|
||||
include=includes, exclude=excludes,
|
||||
default='relpath'))
|
||||
default='relpath')
|
||||
if subdirs:
|
||||
matcher = forceincludematcher(matcher, subdirs)
|
||||
matchers.append(matcher)
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
|
@ -233,3 +233,11 @@ Verify log --sparse only shows commits that affect the sparse checkout
|
||||
2 1 0 (no-eol)
|
||||
$ hg log --sparse -T '{rev} '
|
||||
2 0 (no-eol)
|
||||
|
||||
Test status on a file in a subdir
|
||||
|
||||
$ mkdir -p dir1/dir2
|
||||
$ touch dir1/dir2/file
|
||||
$ hg sparse -I dir1/dir2
|
||||
$ hg status
|
||||
? dir1/dir2/file
|
||||
|
Loading…
Reference in New Issue
Block a user