[PATCH 2 of 3] shallowstore: remove seemingly unnecessary code

Martin von Zweigbergk martinvonz at google.com
Fri Aug 26 17:47:33 UTC 2016


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1472232010 25200
#      Fri Aug 26 10:20:10 2016 -0700
# Node ID 35fde8eff1569689667c21973fb7193b3ad049b8
# Parent  5cc153cfd69ec19038eb61a87ad33eb233293678
shallowstore: remove seemingly unnecessary code

remotefilelogserver.py already overrides _walkstreamfiles and makes
sure to include locally committed content, so the override in
shallowstore doesn't seem necessary. It also breaks treemanifests,
since it doesn't include the meta/ directory.

diff -r 5cc153cfd69e -r 35fde8eff156 remotefilelog/shallowstore.py
--- a/remotefilelog/shallowstore.py	Thu Aug 25 13:32:07 2016 -0700
+++ b/remotefilelog/shallowstore.py	Fri Aug 26 10:20:10 2016 -0700
@@ -5,41 +5,8 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-from mercurial import util
-from mercurial import store as storemod
-import stat
-
 def wrapstore(store):
     class shallowstore(store.__class__):
-        def _walk(self, relpath, recurse, allfiles=False):
-            """modifies walk to return non .i/.d files so streaming clones
-            can send remotefilelog store/data files
-            """
-            path = self.path
-            if relpath:
-                path += '/' + relpath
-            striplen = len(self.path) + 1
-            l = []
-            if self.rawvfs.isdir(path):
-                visit = [path]
-                readdir = self.rawvfs.readdir
-                while visit:
-                    p = visit.pop()
-                    for f, kind, st in readdir(p, stat=True):
-                        fp = p + '/' + f
-                        if (kind == stat.S_IFREG and
-                           (allfiles or f[-2:] in ('.d', '.i'))):
-                            n = util.pconvert(fp[striplen:])
-                            l.append((storemod.decodedir(n), n, st.st_size))
-                        elif kind == stat.S_IFDIR and recurse:
-                            visit.append(fp)
-            l.sort()
-            return l
-
-        def datafiles(self):
-            for a, b, size in self._walk('data', True, True):
-                yield a, b, size
-
         def __contains__(self, path):
             # Assume it exists
             return True



More information about the Mercurial-devel mailing list