##// END OF EJS Templates
discovery: use a lower level but faster way to retrieve parents...
marmoute -
r42047:e514799e default
parent child Browse files
Show More
@@ -165,6 +165,12 b' class partialdiscovery(object):'
165 # common.bases and all its ancestors
165 # common.bases and all its ancestors
166 return self._common.basesheads()
166 return self._common.basesheads()
167
167
168 def _parentsgetter(self):
169 getrev = self._repo.changelog.index.__getitem__
170 def getparents(r):
171 return getrev(r)[5:6]
172 return getparents
173
168 def takequicksample(self, headrevs, size):
174 def takequicksample(self, headrevs, size):
169 """takes a quick sample of size <size>
175 """takes a quick sample of size <size>
170
176
@@ -181,7 +187,7 b' class partialdiscovery(object):'
181 if len(sample) >= size:
187 if len(sample) >= size:
182 return _limitsample(sample, size)
188 return _limitsample(sample, size)
183
189
184 _updatesample(None, headrevs, sample, self._repo.changelog.parentrevs,
190 _updatesample(None, headrevs, sample, self._parentsgetter(),
185 quicksamplesize=size)
191 quicksamplesize=size)
186 return sample
192 return sample
187
193
@@ -191,10 +197,11 b' class partialdiscovery(object):'
191 return list(revs)
197 return list(revs)
192 repo = self._repo
198 repo = self._repo
193 sample = set(repo.revs('heads(%ld)', revs))
199 sample = set(repo.revs('heads(%ld)', revs))
200 parentrevs = self._parentsgetter()
194
201
195 # update from heads
202 # update from heads
196 revsheads = sample.copy()
203 revsheads = sample.copy()
197 _updatesample(revs, revsheads, sample, repo.changelog.parentrevs)
204 _updatesample(revs, revsheads, sample, parentrevs)
198
205
199 # update from roots
206 # update from roots
200 revsroots = set(repo.revs('roots(%ld)', revs))
207 revsroots = set(repo.revs('roots(%ld)', revs))
@@ -209,7 +216,6 b' class partialdiscovery(object):'
209 # this by keeping a persistent cache of children across invocations.
216 # this by keeping a persistent cache of children across invocations.
210 children = {}
217 children = {}
211
218
212 parentrevs = repo.changelog.parentrevs
213 for rev in repo.changelog.revs(start=min(revsroots)):
219 for rev in repo.changelog.revs(start=min(revsroots)):
214 # Always ensure revision has an entry so we don't need to worry
220 # Always ensure revision has an entry so we don't need to worry
215 # about missing keys.
221 # about missing keys.
General Comments 0
You need to be logged in to leave comments. Login now