# HG changeset patch # User Martin von Zweigbergk # Date 1456728667 28800 # Node ID 277a22cd8741c6e0b7855b85fddf458c511a02a9 # Parent 11287888ce4b927acf6e900aa8c2ab1eee75e397 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'". diff -r 11287888ce4b -r 277a22cd8741 mercurial/changegroup.py --- 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)):