Skip to content
Snippets Groups Projects
Commit 2d45b549 authored by Pulkit Goyal's avatar Pulkit Goyal
Browse files

store: pass matcher to store.datafiles()

To get narrow stream clones working, we need a way to filter the storage files
using a matcher. This patch adds matcher as an argument to store.walk() and
store.datafiles() so that we can filter the files returned according to the
matcher.

Differential Revision: https://phab.mercurial-scm.org/D4850
parent f0e8f277
No related branches found
No related tags found
No related merge requests found
......@@ -359,10 +359,10 @@
l.sort()
return l
def datafiles(self):
def datafiles(self, matcher=None):
return self._walk('data', True) + self._walk('meta', True)
def topfiles(self):
# yield manifest before changelog
return reversed(self._walk('', False))
......@@ -363,9 +363,13 @@
return self._walk('data', True) + self._walk('meta', True)
def topfiles(self):
# yield manifest before changelog
return reversed(self._walk('', False))
def walk(self):
'''yields (unencoded, encoded, size)'''
def walk(self, matcher=None):
'''yields (unencoded, encoded, size)
if a matcher is passed, storage files of only those tracked paths
are passed with matches the matcher
'''
# yield data files first
......@@ -371,5 +375,5 @@
# yield data files first
for x in self.datafiles():
for x in self.datafiles(matcher):
yield x
for x in self.topfiles():
yield x
......@@ -407,7 +411,7 @@
self.vfs = vfsmod.filtervfs(vfs, encodefilename)
self.opener = self.vfs
def datafiles(self):
def datafiles(self, matcher=None):
for a, b, size in super(encodedstore, self).datafiles():
try:
a = decodefilename(a)
......@@ -536,7 +540,7 @@
def getsize(self, path):
return self.rawvfs.stat(path).st_size
def datafiles(self):
def datafiles(self, matcher=None):
for f in sorted(self.fncache):
ef = self.encode(f)
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment