##// END OF EJS Templates
discovery: move handling of sampling special case inside sampling function...
Boris Feld -
r41146:3c85a62d default
parent child Browse files
Show More
@@ -102,6 +102,8 b' def _takequicksample(repo, headrevs, rev'
102 :headrevs: set of head revisions in local DAG to consider
102 :headrevs: set of head revisions in local DAG to consider
103 :revs: set of revs to discover
103 :revs: set of revs to discover
104 :size: the maximum size of the sample"""
104 :size: the maximum size of the sample"""
105 if len(revs) <= size:
106 return list(revs)
105 sample = set(repo.revs('heads(%ld)', revs))
107 sample = set(repo.revs('heads(%ld)', revs))
106
108
107 if len(sample) >= size:
109 if len(sample) >= size:
@@ -112,6 +114,8 b' def _takequicksample(repo, headrevs, rev'
112 return sample
114 return sample
113
115
114 def _takefullsample(repo, headrevs, revs, size):
116 def _takefullsample(repo, headrevs, revs, size):
117 if len(revs) <= size:
118 return list(revs)
115 sample = set(repo.revs('heads(%ld)', revs))
119 sample = set(repo.revs('heads(%ld)', revs))
116
120
117 # update from heads
121 # update from heads
@@ -264,10 +268,7 b' def findcommonheads(ui, local, remote,'
264 ui.debug("taking quick initial sample\n")
268 ui.debug("taking quick initial sample\n")
265 samplefunc = _takequicksample
269 samplefunc = _takequicksample
266 targetsize = initialsamplesize
270 targetsize = initialsamplesize
267 if len(undecided) <= targetsize:
271 sample = samplefunc(local, ownheads, undecided, targetsize)
268 sample = list(undecided)
269 else:
270 sample = samplefunc(local, ownheads, undecided, targetsize)
271
272
272 roundtrips += 1
273 roundtrips += 1
273 progress.update(roundtrips)
274 progress.update(roundtrips)
General Comments 0
You need to be logged in to leave comments. Login now