Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG2f5c622fcb73: treediscovery: use progress helper
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| pulkit |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/treediscovery.py (7 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Martin von Zweigbergk | Jun 18 2018, 2:54 AM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| else: | else: | ||||
| base.add(h) | base.add(h) | ||||
| if not unknown: | if not unknown: | ||||
| return list(base), [], list(heads) | return list(base), [], list(heads) | ||||
| req = set(unknown) | req = set(unknown) | ||||
| reqcnt = 0 | reqcnt = 0 | ||||
| progress = repo.ui.makeprogress(_('searching'), unit=_('queries')) | |||||
| # search through remote branches | # search through remote branches | ||||
| # a 'branch' here is a linear segment of history, with four parts: | # a 'branch' here is a linear segment of history, with four parts: | ||||
| # head, root, first parent, second parent | # head, root, first parent, second parent | ||||
| # (a branch always has two parents (or none) by definition) | # (a branch always has two parents (or none) by definition) | ||||
| with remote.commandexecutor() as e: | with remote.commandexecutor() as e: | ||||
| branches = e.callcommand('branches', {'nodes': unknown}).result() | branches = e.callcommand('branches', {'nodes': unknown}).result() | ||||
| for p in n[2:4]: | for p in n[2:4]: | ||||
| if p not in req and not knownnode(p): | if p not in req and not knownnode(p): | ||||
| r.append(p) | r.append(p) | ||||
| req.add(p) | req.add(p) | ||||
| seen.add(n[0]) | seen.add(n[0]) | ||||
| if r: | if r: | ||||
| reqcnt += 1 | reqcnt += 1 | ||||
| repo.ui.progress(_('searching'), reqcnt, unit=_('queries')) | progress.increment() | ||||
| repo.ui.debug("request %d: %s\n" % | repo.ui.debug("request %d: %s\n" % | ||||
| (reqcnt, " ".join(map(short, r)))) | (reqcnt, " ".join(map(short, r)))) | ||||
| for p in xrange(0, len(r), 10): | for p in xrange(0, len(r), 10): | ||||
| with remote.commandexecutor() as e: | with remote.commandexecutor() as e: | ||||
| branches = e.callcommand('branches', { | branches = e.callcommand('branches', { | ||||
| 'nodes': r[p:p + 10], | 'nodes': r[p:p + 10], | ||||
| }).result() | }).result() | ||||
| for b in branches: | for b in branches: | ||||
| repo.ui.debug("received %s:%s\n" % | repo.ui.debug("received %s:%s\n" % | ||||
| (short(b[0]), short(b[1]))) | (short(b[0]), short(b[1]))) | ||||
| unknown.append(b) | unknown.append(b) | ||||
| # do binary search on the branches we found | # do binary search on the branches we found | ||||
| while search: | while search: | ||||
| newsearch = [] | newsearch = [] | ||||
| reqcnt += 1 | reqcnt += 1 | ||||
| repo.ui.progress(_('searching'), reqcnt, unit=_('queries')) | progress.increment() | ||||
| with remote.commandexecutor() as e: | with remote.commandexecutor() as e: | ||||
| between = e.callcommand('between', {'pairs': search}).result() | between = e.callcommand('between', {'pairs': search}).result() | ||||
| for n, l in zip(search, between): | for n, l in zip(search, between): | ||||
| l.append(n[1]) | l.append(n[1]) | ||||
| p = n[0] | p = n[0] | ||||
| f = 1 | f = 1 | ||||
| if force: | if force: | ||||
| repo.ui.warn(_("warning: repository is unrelated\n")) | repo.ui.warn(_("warning: repository is unrelated\n")) | ||||
| else: | else: | ||||
| raise error.Abort(_("repository is unrelated")) | raise error.Abort(_("repository is unrelated")) | ||||
| repo.ui.debug("found new changesets starting at " + | repo.ui.debug("found new changesets starting at " + | ||||
| " ".join([short(f) for f in fetch]) + "\n") | " ".join([short(f) for f in fetch]) + "\n") | ||||
| repo.ui.progress(_('searching'), None) | progress.complete() | ||||
| repo.ui.debug("%d total queries\n" % reqcnt) | repo.ui.debug("%d total queries\n" % reqcnt) | ||||
| return base, list(fetch), heads | return base, list(fetch), heads | ||||