Changeset 4fca4b7633a8…
Parent 23240f0f5ecc…
by
Changes to 2 files · Browse files at 4fca4b7633a8 Showing diff from parent 23240f0f5ecc Diff from another changeset...
@@ -98,18 +98,16 @@ """
raise NotImplementedError(self.add_objects)
- def find_missing_objects(self, wants, graph_walker, progress=None):
+ def find_missing_objects(self, haves, wants, progress=None):
"""Find the missing objects required for a set of revisions.
+ :param haves: Iterable over SHAs already in common.
:param wants: Iterable over SHAs of objects to fetch.
- :param graph_walker: Object that can iterate over the list of revisions
- to fetch and has an "ack" method that will be called to acknowledge
- that a revision is present.
:param progress: Simple progress function that will be called with
updated progress strings.
:return: Iterator over (sha, path) pairs.
"""
- return iter(MissingObjectFinder(self, wants, graph_walker, progress).next, None)
+ return iter(MissingObjectFinder(self, haves, wants, progress).next, None)
def get_commit_parents(self, sha):
"""Retrieve the parents of a commit.
@@ -450,19 +448,14 @@ :param progress: Optional function to report progress to.
"""
- def __init__(self, object_store, wants, graph_walker, progress=None):
- self.sha_done = set()
+ def __init__(self, haves, wants, graph_walker, progress=None):
+ self.sha_done = set(haves)
self.objects_to_send = set([(w, None, False) for w in wants])
self.object_store = object_store
if progress is None:
self.progress = lambda x: None
else:
self.progress = progress
- ref = graph_walker.next()
- while ref:
- if ref in self.object_store:
- graph_walker.ack(ref)
- ref = graph_walker.next()
def add_todo(self, entries):
self.objects_to_send.update([e for e in entries if not e[0] in self.sha_done])
|
@@ -125,22 +125,6 @@ """Check if an index is present."""
return os.path.exists(self.index_path())
- def find_missing_objects(self, determine_wants, graph_walker, progress):
- """Find the missing objects required for a set of revisions.
-
- :param determine_wants: Function that takes a dictionary with heads
- and returns the list of heads to fetch.
- :param graph_walker: Object that can iterate over the list of revisions
- to fetch and has an "ack" method that will be called to acknowledge
- that a revision is present.
- :param progress: Simple progress function that will be called with
- updated progress strings.
- :return: Iterator over (sha, path) pairs.
- """
- wants = determine_wants(self.get_refs())
- return self.object_store.find_missing_objects(wants,
- graph_walker, progress)
-
def fetch_objects(self, determine_wants, graph_walker, progress):
"""Fetch the missing objects required for a set of revisions.
@@ -153,8 +137,10 @@ updated progress strings.
:return: tuple with number of objects, iterator over objects
"""
+ wants = determine_wants(self.get_refs())
+ haves = self.object_store.find_missing_revisions(graphwalker)
return self.object_store.iter_shas(
- self.find_missing_objects(determine_wants, graph_walker, progress))
+ self.object_store.find_missing_objects(haves, wants, progress))
def get_graph_walker(self, heads=None):
if heads is None:
|
Loading...