hg: wrap convert in a big transaction for better pack behavior

Summary:
We noticed that the runtime for convert was exponential
due to way that packs were managed.

This wraps the convert in a big transaction so that we reuse an
existing pack rather than writing out one for each commit.

Reviewed By: xavierd

Differential Revision: D17138073

fbshipit-source-id: 46e418a49f917e2ffc411920ace1a3d98ac6b8e4
This commit is contained in:
Wez Furlong 2019-08-30 14:07:54 -07:00 committed by Facebook Github Bot
parent 8a28530f5f
commit 846de7e82f

View File

@ -502,19 +502,22 @@ class converter(object):
c = None
self.ui.status(_("converting...\n"))
with progress.bar(self.ui, _("converting"), _("revisions"), len(t)) as prog:
for i, c in enumerate(t):
num -= 1
desc = self.commitcache[c].desc
if "\n" in desc:
desc = desc.splitlines()[0]
# convert log message to local encoding without using
# tolocal() because the encoding.encoding convert()
# uses is 'utf-8'
self.ui.status("%d %s\n" % (num, recode(desc)))
self.ui.note(_("source: %s\n") % recode(c))
prog.value = i
self.copy(c)
with self.dest.repo.transaction("convert"):
with progress.bar(
self.ui, _("converting"), _("revisions"), len(t)
) as prog:
for i, c in enumerate(t):
num -= 1
desc = self.commitcache[c].desc
if "\n" in desc:
desc = desc.splitlines()[0]
# convert log message to local encoding without using
# tolocal() because the encoding.encoding convert()
# uses is 'utf-8'
self.ui.status("%d %s\n" % (num, recode(desc)))
self.ui.note(_("source: %s\n") % recode(c))
prog.value = i
self.copy(c)
if not self.ui.configbool("convert", "skiptags"):
tags = self.source.gettags()