mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
context: remove use of dirstate.walk
Summary: In a future diff we'll be restricting the dirstate interface. We'd like to drop dirstate.walk, so let's remove it's use from commitablectx.walk. Reviewed By: quark-zju Differential Revision: D17082284 fbshipit-source-id: f6034281c10123c28c37ee93844ac7e05418973f
This commit is contained in:
parent
7b4ce229db
commit
2bb8d905d4
@ -1601,7 +1601,25 @@ class committablectx(basectx):
|
||||
|
||||
def walk(self, match):
|
||||
"""Generates matching file names."""
|
||||
return sorted(self._repo.dirstate.walk(match, unknown=True, ignored=False))
|
||||
repo = self._repo
|
||||
dirstate = repo.dirstate
|
||||
status = dirstate.status(match, False, True, True)
|
||||
files = set(file for files in status for file in files)
|
||||
|
||||
# It's expensive to ask status to return ignored files, and we only care
|
||||
# about it for explicitly mentioned files, so let's manually check them.
|
||||
# Also check for explicitly requested files. There's legacy behavior
|
||||
# where walk is expected to return explicitly requested files, even if
|
||||
# the provided matcher says we shouldn't visit the directories leading
|
||||
# to the explicit file (ex: `hg debugwalk -Xbeans beans/black` should
|
||||
# show beans/black).
|
||||
ignored = dirstate._ignore
|
||||
files.update(
|
||||
file
|
||||
for file in match.files()
|
||||
if file in self or (ignored(file) and repo.wvfs.isfileorlink(file))
|
||||
)
|
||||
return sorted(files)
|
||||
|
||||
def matches(self, match):
|
||||
return sorted(self._repo.dirstate.matches(match))
|
||||
|
@ -112,10 +112,11 @@ Create a client
|
||||
|
||||
Rename the file in a commit
|
||||
$ hg mv a/b/c/d/e/f/g/h/i/j/file a/b/c/d/e/f/g/h/i/j/file2
|
||||
$ hg commit -m "rename"
|
||||
fetching tree '' efa8fa4352b919302f90e85924e691a632d6bea0, found via 9f95b8f1011f
|
||||
11 trees fetched over *s (glob)
|
||||
* files fetched over *s (glob)
|
||||
$ hg commit -m "rename"
|
||||
* files fetched over *s (glob)
|
||||
|
||||
Amend the commit to add a new file with an empty cache, with descendantrevfastpath enabled
|
||||
$ clearcache
|
||||
|
Loading…
Reference in New Issue
Block a user