changeset 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 1e37bd83dc66
children ca656f3dffd7
files mercurial/changegroup.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Sun Jun 07 15:52:57 2015 -0700
+++ b/mercurial/changegroup.py	Sun Jun 07 15:57:40 2015 -0700
@@ -695,7 +695,7 @@
     return revisions, files
 
 def addchangegroup(repo, source, srctype, url, emptyok=False,
-                   targetphase=phases.draft):
+                   targetphase=phases.draft, expectedtotal=None):
     """Add the changegroup returned by source.read() to this repo.
     srctype is a string like 'push', 'pull', or 'unbundle'.  url is
     the URL of the repo where this changegroup is coming from.
@@ -744,7 +744,7 @@
             step = _('changesets')
             count = 1
             ui = repo.ui
-            total = None
+            total = expectedtotal
             def __call__(repo):
                 repo.ui.progress(repo.step, repo.count, unit=_('chunks'),
                                  total=repo.total)