changeset 28361:277a22cd8741

changegroup: progress for added files is not measured in "chunks" The "prog" class cg1unpacker.apply() has the unit set to "chunks". This is not correct for files, where the file itself is the unit. The unit is not usually printed, which is probably why this has not been fixed yet. It can be show with e.g. "--config progress.format='topic number unit'".
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 28 Feb 2016 22:51:07 -0800
parents 11287888ce4b
children 1f94ef2bd88d
files mercurial/changegroup.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Sun Feb 28 21:15:06 2016 -0800
+++ b/mercurial/changegroup.py	Sun Feb 28 22:51:07 2016 -0800
@@ -394,9 +394,8 @@
 
                 # process the files
                 repo.ui.status(_("adding file changes\n"))
-                pr = prog(_('files'), efiles)
                 newrevs, newfiles = _addchangegroupfiles(
-                    repo, self, revmap, trp, pr, needfiles)
+                    repo, self, revmap, trp, efiles, needfiles)
                 revisions += newrevs
                 files += newfiles
 
@@ -1068,16 +1067,18 @@
     # to avoid a race we use changegroupsubset() (issue1320)
     return changegroupsubset(repo, basenodes, repo.heads(), source)
 
-def _addchangegroupfiles(repo, source, revmap, trp, pr, needfiles):
+def _addchangegroupfiles(repo, source, revmap, trp, expectedfiles, needfiles):
     revisions = 0
     files = 0
     while True:
         chunkdata = source.filelogheader()
         if not chunkdata:
             break
+        files += 1
         f = chunkdata["filename"]
         repo.ui.debug("adding %s revisions\n" % f)
-        pr()
+        repo.ui.progress(_('files'), files, unit=_('files'),
+                         total=expectedfiles)
         fl = repo.file(f)
         o = len(fl)
         try:
@@ -1086,7 +1087,6 @@
         except error.CensoredBaseError as e:
             raise error.Abort(_("received delta base is censored: %s") % e)
         revisions += len(fl) - o
-        files += 1
         if f in needfiles:
             needs = needfiles[f]
             for new in xrange(o, len(fl)):