Changeset 09a6d515a7ed…
Parent a6b45a39af11…
by
Changes to 2 files · Browse files at 09a6d515a7ed Showing diff from parent a6b45a39af11 Diff from another changeset...
@@ -39,6 +39,9 @@ self.path = path
self._packs = None
+ def iter_shas(self, shas):
+ return ObjectIterator(self, shas)
+
def pack_dir(self):
return os.path.join(self.path, PACKDIR)
@@ -171,3 +174,28 @@ f, commit = self.add_pack()
write_pack_data(f, objects, len(objects))
commit()
+
+
+class ObjectImporter(object):
+
+ def __init__(self, count):
+ self.count = count
+
+ def add_object(self, object):
+ raise NotImplementedError(self.add_object)
+
+ def finish(self, object):
+ raise NotImplementedError(self.finish)
+
+
+class ObjectIterator(object):
+
+ def __init__(self, store, shas):
+ self.store = store
+ self.shas = shas
+
+ def __iter__(self):
+ return ((self.store.get_object(sha), path) for sha, path in self.shas)
+
+ def __len__(self):
+ return len(self.shas)
|
@@ -144,8 +144,8 @@ updated progress strings.
:return: tuple with number of objects, iterator over objects
"""
- shas = self.find_missing_objects(determine_wants, graph_walker, progress)
- return (len(shas), ((self.get_object(sha), path) for sha, path in shas))
+ return self.object_store.iter_shas(
+ self.find_missing_objects(determine_wants, graph_walker, progress))
def object_dir(self):
return os.path.join(self.controldir(), OBJECTDIR)
@@ -313,5 +313,3 @@
create = init_bare
-
-
|
Loading...