Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 7208:acb87c5b4aeb
findincoming: do the binary search in branches in parallel
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 22 Oct 2008 21:43:35 +0200 |
parents | cb6395fc16a9 |
children | b71a52f101dc |
comparison
equal
deleted
inserted
replaced
7207:fe0a4ed4634f | 7208:acb87c5b4aeb |
---|---|
1341 self.ui.debug(_("received %s:%s\n") % | 1341 self.ui.debug(_("received %s:%s\n") % |
1342 (short(b[0]), short(b[1]))) | 1342 (short(b[0]), short(b[1]))) |
1343 unknown.append(b) | 1343 unknown.append(b) |
1344 | 1344 |
1345 # do binary search on the branches we found | 1345 # do binary search on the branches we found |
1346 search = [(t, b) for (t, b, p1, p2) in search] | |
1346 while search: | 1347 while search: |
1347 n = search.pop(0) | 1348 newsearch = [] |
1348 reqcnt += 1 | 1349 reqcnt += 1 |
1349 l = remote.between([(n[0], n[1])])[0] | 1350 for n, l in zip(search, remote.between(search)): |
1350 l.append(n[1]) | 1351 l.append(n[1]) |
1351 p = n[0] | 1352 p = n[0] |
1352 f = 1 | 1353 f = 1 |
1353 for i in l: | 1354 for i in l: |
1354 self.ui.debug(_("narrowing %d:%d %s\n") % (f, len(l), short(i))) | 1355 self.ui.debug(_("narrowing %d:%d %s\n") % (f, len(l), short(i))) |
1355 if i in m: | 1356 if i in m: |
1356 if f <= 2: | 1357 if f <= 2: |
1357 self.ui.debug(_("found new branch changeset %s\n") % | 1358 self.ui.debug(_("found new branch changeset %s\n") % |
1358 short(p)) | 1359 short(p)) |
1359 fetch[p] = 1 | 1360 fetch[p] = 1 |
1360 base[i] = 1 | 1361 base[i] = 1 |
1361 else: | 1362 else: |
1362 self.ui.debug(_("narrowed branch search to %s:%s\n") | 1363 self.ui.debug(_("narrowed branch search to %s:%s\n") |
1363 % (short(p), short(i))) | 1364 % (short(p), short(i))) |
1364 search.append((p, i)) | 1365 newsearch.append((p, i)) |
1365 break | 1366 break |
1366 p, f = i, f * 2 | 1367 p, f = i, f * 2 |
1368 search = newsearch | |
1367 | 1369 |
1368 # sanity check our fetch list | 1370 # sanity check our fetch list |
1369 for f in fetch.keys(): | 1371 for f in fetch.keys(): |
1370 if f in m: | 1372 if f in m: |
1371 raise repo.RepoError(_("already have changeset ") + short(f[:4])) | 1373 raise repo.RepoError(_("already have changeset ") + short(f[:4])) |