Mercurial > hg
comparison mercurial/changegroup.py @ 25517:513c31d8652f
addchangegroup: accept an expected total number of changesets as argument
Caller can optionally informs how much changesets are expected to be added. This
will be used for a more useful progress bar output.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sun, 07 Jun 2015 15:57:40 -0700 |
parents | 19717d3c8f94 |
children | 3e89e67f17e8 |
comparison
equal
deleted
inserted
replaced
25516:1e37bd83dc66 | 25517:513c31d8652f |
---|---|
693 (f, hex(n))) | 693 (f, hex(n))) |
694 | 694 |
695 return revisions, files | 695 return revisions, files |
696 | 696 |
697 def addchangegroup(repo, source, srctype, url, emptyok=False, | 697 def addchangegroup(repo, source, srctype, url, emptyok=False, |
698 targetphase=phases.draft): | 698 targetphase=phases.draft, expectedtotal=None): |
699 """Add the changegroup returned by source.read() to this repo. | 699 """Add the changegroup returned by source.read() to this repo. |
700 srctype is a string like 'push', 'pull', or 'unbundle'. url is | 700 srctype is a string like 'push', 'pull', or 'unbundle'. url is |
701 the URL of the repo where this changegroup is coming from. | 701 the URL of the repo where this changegroup is coming from. |
702 | 702 |
703 Return an integer summarizing the change to this repo: | 703 Return an integer summarizing the change to this repo: |
742 clstart = len(cl) | 742 clstart = len(cl) |
743 class prog(object): | 743 class prog(object): |
744 step = _('changesets') | 744 step = _('changesets') |
745 count = 1 | 745 count = 1 |
746 ui = repo.ui | 746 ui = repo.ui |
747 total = None | 747 total = expectedtotal |
748 def __call__(repo): | 748 def __call__(repo): |
749 repo.ui.progress(repo.step, repo.count, unit=_('chunks'), | 749 repo.ui.progress(repo.step, repo.count, unit=_('chunks'), |
750 total=repo.total) | 750 total=repo.total) |
751 repo.count += 1 | 751 repo.count += 1 |
752 pr = prog() | 752 pr = prog() |