514 reorder = None |
514 reorder = None |
515 else: |
515 else: |
516 reorder = stringutil.parsebool(reorder) |
516 reorder = stringutil.parsebool(reorder) |
517 self._repo = repo |
517 self._repo = repo |
518 self._reorder = reorder |
518 self._reorder = reorder |
519 self._progress = repo.ui.progress |
|
520 if self._repo.ui.verbose and not self._repo.ui.debugflag: |
519 if self._repo.ui.verbose and not self._repo.ui.debugflag: |
521 self._verbosenote = self._repo.ui.note |
520 self._verbosenote = self._repo.ui.note |
522 else: |
521 else: |
523 self._verbosenote = lambda s: None |
522 self._verbosenote = lambda s: None |
524 |
523 |
563 # add the parent of the first rev |
562 # add the parent of the first rev |
564 p = revlog.parentrevs(revs[0])[0] |
563 p = revlog.parentrevs(revs[0])[0] |
565 revs.insert(0, p) |
564 revs.insert(0, p) |
566 |
565 |
567 # build deltas |
566 # build deltas |
568 total = len(revs) - 1 |
567 progress = None |
569 msgbundling = _('bundling') |
568 if units is not None: |
|
569 progress = self._repo.ui.makeprogress(_('bundling'), unit=units, |
|
570 total=(len(revs) - 1)) |
570 for r in xrange(len(revs) - 1): |
571 for r in xrange(len(revs) - 1): |
571 if units is not None: |
572 if progress: |
572 self._progress(msgbundling, r + 1, unit=units, total=total) |
573 progress.update(r + 1) |
573 prev, curr = revs[r], revs[r + 1] |
574 prev, curr = revs[r], revs[r + 1] |
574 linknode = lookup(revlog.node(curr)) |
575 linknode = lookup(revlog.node(curr)) |
575 for c in self.revchunk(revlog, curr, prev, linknode): |
576 for c in self.revchunk(revlog, curr, prev, linknode): |
576 yield c |
577 yield c |
577 |
578 |
578 if units is not None: |
579 if progress: |
579 self._progress(msgbundling, None) |
580 progress.complete() |
580 yield self.close() |
581 yield self.close() |
581 |
582 |
582 # filter any nodes that claim to be part of the known set |
583 # filter any nodes that claim to be part of the known set |
583 def prune(self, revlog, missing, commonrevs): |
584 def prune(self, revlog, missing, commonrevs): |
584 rr, rl = revlog.rev, revlog.linkrev |
585 rr, rl = revlog.rev, revlog.linkrev |
740 yield self._manifestsdone() |
741 yield self._manifestsdone() |
741 |
742 |
742 # The 'source' parameter is useful for extensions |
743 # The 'source' parameter is useful for extensions |
743 def generatefiles(self, changedfiles, linknodes, commonrevs, source): |
744 def generatefiles(self, changedfiles, linknodes, commonrevs, source): |
744 repo = self._repo |
745 repo = self._repo |
745 progress = self._progress |
746 progress = repo.ui.makeprogress(_('bundling'), unit=_('files'), |
746 msgbundling = _('bundling') |
747 total=len(changedfiles)) |
747 |
|
748 total = len(changedfiles) |
|
749 # for progress output |
|
750 msgfiles = _('files') |
|
751 for i, fname in enumerate(sorted(changedfiles)): |
748 for i, fname in enumerate(sorted(changedfiles)): |
752 filerevlog = repo.file(fname) |
749 filerevlog = repo.file(fname) |
753 if not filerevlog: |
750 if not filerevlog: |
754 raise error.Abort(_("empty or missing file data for %s") % |
751 raise error.Abort(_("empty or missing file data for %s") % |
755 fname) |
752 fname) |
760 def lookupfilelog(x): |
757 def lookupfilelog(x): |
761 return linkrevnodes[x] |
758 return linkrevnodes[x] |
762 |
759 |
763 filenodes = self.prune(filerevlog, linkrevnodes, commonrevs) |
760 filenodes = self.prune(filerevlog, linkrevnodes, commonrevs) |
764 if filenodes: |
761 if filenodes: |
765 progress(msgbundling, i + 1, item=fname, unit=msgfiles, |
762 progress.update(i + 1, item=fname) |
766 total=total) |
|
767 h = self.fileheader(fname) |
763 h = self.fileheader(fname) |
768 size = len(h) |
764 size = len(h) |
769 yield h |
765 yield h |
770 for chunk in self.group(filenodes, filerevlog, lookupfilelog): |
766 for chunk in self.group(filenodes, filerevlog, lookupfilelog): |
771 size += len(chunk) |
767 size += len(chunk) |
772 yield chunk |
768 yield chunk |
773 self._verbosenote(_('%8.i %s\n') % (size, fname)) |
769 self._verbosenote(_('%8.i %s\n') % (size, fname)) |
774 progress(msgbundling, None) |
770 progress.complete() |
775 |
771 |
776 def deltaparent(self, revlog, rev, p1, p2, prev): |
772 def deltaparent(self, revlog, rev, p1, p2, prev): |
777 if not revlog.candelta(prev, rev): |
773 if not revlog.candelta(prev, rev): |
778 raise error.ProgrammingError('cg1 should not be used in this case') |
774 raise error.ProgrammingError('cg1 should not be used in this case') |
779 return prev |
775 return prev |