##// END OF EJS Templates
remotefilelog: use progress helper in repack...
Martin von Zweigbergk -
r40878:b80915b5 default
parent child Browse files
Show More
@@ -495,18 +495,20 b' class repacker(object):'
495 byfile.setdefault(entry.filename, {})[entry.node] = entry
495 byfile.setdefault(entry.filename, {})[entry.node] = entry
496
496
497 count = 0
497 count = 0
498 repackprogress = ui.makeprogress(_("repacking data"), unit=self.unit,
499 total=len(byfile))
498 for filename, entries in sorted(byfile.iteritems()):
500 for filename, entries in sorted(byfile.iteritems()):
499 ui.progress(_("repacking data"), count, unit=self.unit,
501 repackprogress.update(count)
500 total=len(byfile))
501
502
502 ancestors = {}
503 ancestors = {}
503 nodes = list(node for node in entries)
504 nodes = list(node for node in entries)
504 nohistory = []
505 nohistory = []
506 buildprogress = ui.makeprogress(_("building history"), unit='nodes',
507 total=len(nodes))
505 for i, node in enumerate(nodes):
508 for i, node in enumerate(nodes):
506 if node in ancestors:
509 if node in ancestors:
507 continue
510 continue
508 ui.progress(_("building history"), i, unit='nodes',
511 buildprogress.update(i)
509 total=len(nodes))
510 try:
512 try:
511 ancestors.update(self.fullhistory.getancestors(filename,
513 ancestors.update(self.fullhistory.getancestors(filename,
512 node, known=ancestors))
514 node, known=ancestors))
@@ -515,7 +517,7 b' class repacker(object):'
515 # corresponding history entries for them. It's not a big
517 # corresponding history entries for them. It's not a big
516 # deal, but the entries won't be delta'd perfectly.
518 # deal, but the entries won't be delta'd perfectly.
517 nohistory.append(node)
519 nohistory.append(node)
518 ui.progress(_("building history"), None)
520 buildprogress.complete()
519
521
520 # Order the nodes children first, so we can produce reverse deltas
522 # Order the nodes children first, so we can produce reverse deltas
521 orderednodes = list(reversed(self._toposort(ancestors)))
523 orderednodes = list(reversed(self._toposort(ancestors)))
@@ -547,9 +549,11 b' class repacker(object):'
547 nobase = set()
549 nobase = set()
548 referenced = set()
550 referenced = set()
549 nodes = set(nodes)
551 nodes = set(nodes)
552 processprogress = ui.makeprogress(_("processing nodes"),
553 unit='nodes',
554 total=len(orderednodes))
550 for i, node in enumerate(orderednodes):
555 for i, node in enumerate(orderednodes):
551 ui.progress(_("processing nodes"), i, unit='nodes',
556 processprogress.update(i)
552 total=len(orderednodes))
553 # Find delta base
557 # Find delta base
554 # TODO: allow delta'ing against most recent descendant instead
558 # TODO: allow delta'ing against most recent descendant instead
555 # of immediate child
559 # of immediate child
@@ -620,10 +624,10 b' class repacker(object):'
620
624
621 entries[node].datarepacked = True
625 entries[node].datarepacked = True
622
626
623 ui.progress(_("processing nodes"), None)
627 processprogress.complete()
624 count += 1
628 count += 1
625
629
626 ui.progress(_("repacking data"), None)
630 repackprogress.complete()
627 target.close(ledger=ledger)
631 target.close(ledger=ledger)
628
632
629 def repackhistory(self, ledger, target):
633 def repackhistory(self, ledger, target):
@@ -634,7 +638,8 b' class repacker(object):'
634 if entry.historysource:
638 if entry.historysource:
635 byfile.setdefault(entry.filename, {})[entry.node] = entry
639 byfile.setdefault(entry.filename, {})[entry.node] = entry
636
640
637 count = 0
641 progress = ui.makeprogress(_("repacking history"), unit=self.unit,
642 total=len(byfile))
638 for filename, entries in sorted(byfile.iteritems()):
643 for filename, entries in sorted(byfile.iteritems()):
639 ancestors = {}
644 ancestors = {}
640 nodes = list(node for node in entries)
645 nodes = list(node for node in entries)
@@ -678,11 +683,9 b' class repacker(object):'
678 if node in entries:
683 if node in entries:
679 entries[node].historyrepacked = True
684 entries[node].historyrepacked = True
680
685
681 count += 1
686 progress.increment()
682 ui.progress(_("repacking history"), count, unit=self.unit,
683 total=len(byfile))
684
687
685 ui.progress(_("repacking history"), None)
688 progress.complete()
686 target.close(ledger=ledger)
689 target.close(ledger=ledger)
687
690
688 def _toposort(self, ancestors):
691 def _toposort(self, ancestors):
General Comments 0
You need to be logged in to leave comments. Login now