D5378: remotefilelog: use progress helper in repack
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Dec 6 06:41:15 EST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb80915b52476: remotefilelog: use progress helper in repack (authored by martinvonz, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5378?vs=12717&id=12740
REVISION DETAIL
https://phab.mercurial-scm.org/D5378
AFFECTED FILES
hgext/remotefilelog/repack.py
CHANGE DETAILS
diff --git a/hgext/remotefilelog/repack.py b/hgext/remotefilelog/repack.py
--- a/hgext/remotefilelog/repack.py
+++ b/hgext/remotefilelog/repack.py
@@ -495,27 +495,29 @@
byfile.setdefault(entry.filename, {})[entry.node] = entry
count = 0
+ repackprogress = ui.makeprogress(_("repacking data"), unit=self.unit,
+ total=len(byfile))
for filename, entries in sorted(byfile.iteritems()):
- ui.progress(_("repacking data"), count, unit=self.unit,
- total=len(byfile))
+ repackprogress.update(count)
ancestors = {}
nodes = list(node for node in entries)
nohistory = []
+ buildprogress = ui.makeprogress(_("building history"), unit='nodes',
+ total=len(nodes))
for i, node in enumerate(nodes):
if node in ancestors:
continue
- ui.progress(_("building history"), i, unit='nodes',
- total=len(nodes))
+ buildprogress.update(i)
try:
ancestors.update(self.fullhistory.getancestors(filename,
node, known=ancestors))
except KeyError:
# Since we're packing data entries, we may not have the
# corresponding history entries for them. It's not a big
# deal, but the entries won't be delta'd perfectly.
nohistory.append(node)
- ui.progress(_("building history"), None)
+ buildprogress.complete()
# Order the nodes children first, so we can produce reverse deltas
orderednodes = list(reversed(self._toposort(ancestors)))
@@ -547,9 +549,11 @@
nobase = set()
referenced = set()
nodes = set(nodes)
+ processprogress = ui.makeprogress(_("processing nodes"),
+ unit='nodes',
+ total=len(orderednodes))
for i, node in enumerate(orderednodes):
- ui.progress(_("processing nodes"), i, unit='nodes',
- total=len(orderednodes))
+ processprogress.update(i)
# Find delta base
# TODO: allow delta'ing against most recent descendant instead
# of immediate child
@@ -620,10 +624,10 @@
entries[node].datarepacked = True
- ui.progress(_("processing nodes"), None)
+ processprogress.complete()
count += 1
- ui.progress(_("repacking data"), None)
+ repackprogress.complete()
target.close(ledger=ledger)
def repackhistory(self, ledger, target):
@@ -634,7 +638,8 @@
if entry.historysource:
byfile.setdefault(entry.filename, {})[entry.node] = entry
- count = 0
+ progress = ui.makeprogress(_("repacking history"), unit=self.unit,
+ total=len(byfile))
for filename, entries in sorted(byfile.iteritems()):
ancestors = {}
nodes = list(node for node in entries)
@@ -678,11 +683,9 @@
if node in entries:
entries[node].historyrepacked = True
- count += 1
- ui.progress(_("repacking history"), count, unit=self.unit,
- total=len(byfile))
+ progress.increment()
- ui.progress(_("repacking history"), None)
+ progress.complete()
target.close(ledger=ledger)
def _toposort(self, ancestors):
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list