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

Initial work simplifying push/pull.

Changeset 4fca4b7633a8

Parent 23240f0f5ecc

by Jelmer Vernooij

Changes to 2 files · Browse files at 4fca4b7633a8 Showing diff from parent 23240f0f5ecc Diff from another changeset...

 
98
99
100
101
 
102
103
 
104
105
106
107
108
109
110
111
112
 
113
114
115
 
450
451
452
453
454
 
 
455
456
457
458
459
460
461
462
463
464
465
466
467
468
 
98
99
100
 
101
102
103
104
105
 
 
 
106
107
108
109
 
110
111
112
113
 
448
449
450
 
 
451
452
453
454
455
456
457
458
 
 
 
 
 
459
460
461
@@ -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])
Change 1 of 2 Show Entire File dulwich/​repo.py Stacked
 
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
 
153
154
155
 
 
156
157
 
158
159
160
 
125
126
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
129
130
 
137
138
139
140
141
142
 
143
144
145
146
@@ -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: