Kiln » Dependencies » Dulwich Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in master

Support iterating over contents of an object store.

Changeset 09c754f4ded2

Parent cd5a7ac6c7bd

by Jelmer Vernooij

Changes to one file · Browse files at 09c754f4ded2 Showing diff from parent cd5a7ac6c7bd Diff from another changeset...

 
16
17
18
 
19
20
21
 
73
74
75
 
 
 
 
76
77
78
 
92
93
94
 
 
 
 
 
 
 
95
96
97
 
16
17
18
19
20
21
22
 
74
75
76
77
78
79
80
81
82
83
 
97
98
99
100
101
102
103
104
105
106
107
108
109
@@ -16,6 +16,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301, USA.   +import itertools  import os  import tempfile  import urllib2 @@ -73,6 +74,10 @@
  return True   return False   + def __iter__(self): + iterables = self.packs + [self._iter_shafile_shas()] + return itertools.chain(*iterables) +   @property   def packs(self):   """List with pack objects.""" @@ -92,6 +97,13 @@
  file = sha[2:]   # Check from object dir   return os.path.join(self.path, dir, file) + + def _iter_shafile_shas(self): + for base in os.listdir(self.path): + if len(base) != 2: + continue + for rest in os.listdir(os.path.join(self.path, base)): + yield base+rest     def _get_shafile(self, sha):   path = self._get_shafile_path(sha)