Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGdaa08d45740f: changegroup: use progress helper
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/changegroup.py (7 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Martin von Zweigbergk | Jun 18 2018, 2:06 AM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
repo.hook('preoutgoing', throw=True, source=source) | repo.hook('preoutgoing', throw=True, source=source) | ||||
_changegroupinfo(repo, csets, source) | _changegroupinfo(repo, csets, source) | ||||
return bundler.generate(commonrevs, csets, fastpathlinkrev, source) | return bundler.generate(commonrevs, csets, fastpathlinkrev, source) | ||||
def _addchangegroupfiles(repo, source, revmap, trp, expectedfiles, needfiles): | def _addchangegroupfiles(repo, source, revmap, trp, expectedfiles, needfiles): | ||||
revisions = 0 | revisions = 0 | ||||
files = 0 | files = 0 | ||||
progress = repo.ui.makeprogress(_('files'), unit=_('files'), | |||||
total=expectedfiles) | |||||
for chunkdata in iter(source.filelogheader, {}): | for chunkdata in iter(source.filelogheader, {}): | ||||
files += 1 | files += 1 | ||||
f = chunkdata["filename"] | f = chunkdata["filename"] | ||||
repo.ui.debug("adding %s revisions\n" % f) | repo.ui.debug("adding %s revisions\n" % f) | ||||
repo.ui.progress(_('files'), files, unit=_('files'), | progress.increment() | ||||
total=expectedfiles) | |||||
fl = repo.file(f) | fl = repo.file(f) | ||||
o = len(fl) | o = len(fl) | ||||
try: | try: | ||||
deltas = source.deltaiter() | deltas = source.deltaiter() | ||||
if not fl.addgroup(deltas, revmap, trp): | if not fl.addgroup(deltas, revmap, trp): | ||||
raise error.Abort(_("received file revlog group is empty")) | raise error.Abort(_("received file revlog group is empty")) | ||||
except error.CensoredBaseError as e: | except error.CensoredBaseError as e: | ||||
raise error.Abort(_("received delta base is censored: %s") % e) | raise error.Abort(_("received delta base is censored: %s") % e) | ||||
revisions += len(fl) - o | revisions += len(fl) - o | ||||
if f in needfiles: | if f in needfiles: | ||||
needs = needfiles[f] | needs = needfiles[f] | ||||
for new in xrange(o, len(fl)): | for new in xrange(o, len(fl)): | ||||
n = fl.node(new) | n = fl.node(new) | ||||
if n in needs: | if n in needs: | ||||
needs.remove(n) | needs.remove(n) | ||||
else: | else: | ||||
raise error.Abort( | raise error.Abort( | ||||
_("received spurious file revlog entry")) | _("received spurious file revlog entry")) | ||||
if not needs: | if not needs: | ||||
del needfiles[f] | del needfiles[f] | ||||
repo.ui.progress(_('files'), None) | progress.complete() | ||||
for f, needs in needfiles.iteritems(): | for f, needs in needfiles.iteritems(): | ||||
fl = repo.file(f) | fl = repo.file(f) | ||||
for n in needs: | for n in needs: | ||||
try: | try: | ||||
fl.rev(n) | fl.rev(n) | ||||
except error.LookupError: | except error.LookupError: | ||||
raise error.Abort( | raise error.Abort( | ||||
_('missing file data for %s:%s - run hg verify') % | _('missing file data for %s:%s - run hg verify') % | ||||
(f, hex(n))) | (f, hex(n))) | ||||
return revisions, files | return revisions, files |