Patchwork [2,of,5,V3] store: move top file walk to a separate function

login
register
mail settings
Submitter Durham Goode
Date May 8, 2013, 11:24 p.m.
Message ID <bb46f7711dad7512cdde.1368055457@dev350.prn1.facebook.com>
Download mbox | patch
Permalink /patch/1596/
State Accepted
Commit 1e104aaa4c44c37141ace2231b9b636630dc4c32
Headers show

Comments

Durham Goode - May 8, 2013, 11:24 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1368048120 25200
#      Wed May 08 14:22:00 2013 -0700
# Node ID bb46f7711dad7512cdde723db5030540df1142c7
# Parent  517845b6057f5f64c3085e29a33f7da8a3c84774
store: move top file walk to a separate function

Some extensions find it useful to be able to walk the non-data files in the
repo, so I'm moving that part of the walk to a separate function.

In particular, this allows an extension to interact with only the non-filelog
store data (for instance, when cloning everything but filelogs).

Patch

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -322,13 +322,16 @@ 
     def datafiles(self):
         return self._walk('data', True)
 
+    def topfiles(self):
+        # yield manifest before changelog
+        return reversed(self._walk('', False))
+
     def walk(self):
         '''yields (unencoded, encoded, size)'''
         # yield data files first
         for x in self.datafiles():
             yield x
-        # yield manifest before changelog
-        for x in reversed(self._walk('', False)):
+        for x in self.topfiles():
             yield x
 
     def copylist(self):