D3093: store: make file filtering during walk configurable

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Apr 6 19:50:20 UTC 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4c15bee42e9c: store: make file filtering during walk configurable (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3093?vs=7675&id=7803

REVISION DETAIL
  https://phab.mercurial-scm.org/D3093

AFFECTED FILES
  mercurial/store.py

CHANGE DETAILS

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -319,6 +319,9 @@
 _data = ('data meta 00manifest.d 00manifest.i 00changelog.d 00changelog.i'
          ' phaseroots obsstore')
 
+def isrevlog(f, kind, st):
+    return kind == stat.S_IFREG and f[-2:] in ('.i', '.d')
+
 class basicstore(object):
     '''base class for local repository stores'''
     def __init__(self, path, vfstype):
@@ -333,7 +336,7 @@
     def join(self, f):
         return self.path + '/' + encodedir(f)
 
-    def _walk(self, relpath, recurse):
+    def _walk(self, relpath, recurse, filefilter=isrevlog):
         '''yields (unencoded, encoded, size)'''
         path = self.path
         if relpath:
@@ -347,7 +350,7 @@
                 p = visit.pop()
                 for f, kind, st in readdir(p, stat=True):
                     fp = p + '/' + f
-                    if kind == stat.S_IFREG and f[-2:] in ('.d', '.i'):
+                    if filefilter(f, kind, st):
                         n = util.pconvert(fp[striplen:])
                         l.append((decodedir(n), n, st.st_size))
                     elif kind == stat.S_IFDIR and recurse:



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list