Better to pass the operation instead of passing three of it's members (one of
the them is a function call) separately.
This will also be useful in future when we will like to control which things are
upgraded.
marmoute | |
mharbison72 |
hg-reviewers |
Better to pass the operation instead of passing three of it's members (one of
the them is a function call) separately.
This will also be useful in future when we will like to control which things are
upgraded.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/upgrade_utils/engine.py (26 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Changes Planned | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit |
return newrl | return newrl | ||||
def _clonerevlogs( | def _clonerevlogs( | ||||
ui, | ui, | ||||
srcrepo, | srcrepo, | ||||
dstrepo, | dstrepo, | ||||
tr, | tr, | ||||
deltareuse, | upgrade_op, | ||||
forcedeltabothparents, | |||||
revlogs=UPGRADE_ALL_REVLOGS, | |||||
): | ): | ||||
"""Copy revlogs between 2 repos.""" | """Copy revlogs between 2 repos.""" | ||||
revcount = 0 | revcount = 0 | ||||
srcsize = 0 | srcsize = 0 | ||||
srcrawsize = 0 | srcrawsize = 0 | ||||
dstsize = 0 | dstsize = 0 | ||||
fcount = 0 | fcount = 0 | ||||
frevcount = 0 | frevcount = 0 | ||||
progress = srcrepo.ui.makeprogress(_(b'file revisions'), total=frevcount) | progress = srcrepo.ui.makeprogress(_(b'file revisions'), total=frevcount) | ||||
for unencoded, oldrl in sorted(filelogs.items()): | for unencoded, oldrl in sorted(filelogs.items()): | ||||
newrl = _perform_clone( | newrl = _perform_clone( | ||||
ui, | ui, | ||||
dstrepo, | dstrepo, | ||||
tr, | tr, | ||||
oldrl, | oldrl, | ||||
unencoded, | unencoded, | ||||
deltareuse, | upgrade_op.delta_reuse_mode, | ||||
forcedeltabothparents, | upgrade_op.has_upgrade_action(b're-delta-multibase'), | ||||
revlogs, | upgrade_op.revlogs_to_process, | ||||
sidedatacompanion, | sidedatacompanion, | ||||
oncopiedrevision, | oncopiedrevision, | ||||
) | ) | ||||
info = newrl.storageinfo(storedsize=True) | info = newrl.storageinfo(storedsize=True) | ||||
fdstsize += info[b'storedsize'] or 0 | fdstsize += info[b'storedsize'] or 0 | ||||
ui.status( | ui.status( | ||||
_( | _( | ||||
b'finished migrating %d filelog revisions across %d ' | b'finished migrating %d filelog revisions across %d ' | ||||
) | ) | ||||
for unencoded, oldrl in sorted(manifests.items()): | for unencoded, oldrl in sorted(manifests.items()): | ||||
newrl = _perform_clone( | newrl = _perform_clone( | ||||
ui, | ui, | ||||
dstrepo, | dstrepo, | ||||
tr, | tr, | ||||
oldrl, | oldrl, | ||||
unencoded, | unencoded, | ||||
deltareuse, | upgrade_op.delta_reuse_mode, | ||||
forcedeltabothparents, | upgrade_op.has_upgrade_action(b're-delta-multibase'), | ||||
revlogs, | upgrade_op.revlogs_to_process, | ||||
sidedatacompanion, | sidedatacompanion, | ||||
oncopiedrevision, | oncopiedrevision, | ||||
) | ) | ||||
info = newrl.storageinfo(storedsize=True) | info = newrl.storageinfo(storedsize=True) | ||||
mdstsize += info[b'storedsize'] or 0 | mdstsize += info[b'storedsize'] or 0 | ||||
ui.status( | ui.status( | ||||
_( | _( | ||||
b'finished migrating %d manifest revisions across %d ' | b'finished migrating %d manifest revisions across %d ' | ||||
) | ) | ||||
for unencoded, oldrl in sorted(changelogs.items()): | for unencoded, oldrl in sorted(changelogs.items()): | ||||
newrl = _perform_clone( | newrl = _perform_clone( | ||||
ui, | ui, | ||||
dstrepo, | dstrepo, | ||||
tr, | tr, | ||||
oldrl, | oldrl, | ||||
unencoded, | unencoded, | ||||
deltareuse, | upgrade_op.delta_reuse_mode, | ||||
forcedeltabothparents, | upgrade_op.has_upgrade_action(b're-delta-multibase'), | ||||
revlogs, | upgrade_op.revlogs_to_process, | ||||
sidedatacompanion, | sidedatacompanion, | ||||
oncopiedrevision, | oncopiedrevision, | ||||
) | ) | ||||
info = newrl.storageinfo(storedsize=True) | info = newrl.storageinfo(storedsize=True) | ||||
cdstsize += info[b'storedsize'] or 0 | cdstsize += info[b'storedsize'] or 0 | ||||
progress.complete() | progress.complete() | ||||
ui.status( | ui.status( | ||||
_( | _( | ||||
) | ) | ||||
with dstrepo.transaction(b'upgrade') as tr: | with dstrepo.transaction(b'upgrade') as tr: | ||||
_clonerevlogs( | _clonerevlogs( | ||||
ui, | ui, | ||||
srcrepo, | srcrepo, | ||||
dstrepo, | dstrepo, | ||||
tr, | tr, | ||||
upgrade_op.delta_reuse_mode, | upgrade_op, | ||||
upgrade_op.has_upgrade_action(b're-delta-multibase'), | |||||
revlogs=upgrade_op.revlogs_to_process, | |||||
) | ) | ||||
# Now copy other files in the store directory. | # Now copy other files in the store directory. | ||||
# The sorted() makes execution deterministic. | # The sorted() makes execution deterministic. | ||||
for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)): | for p, kind, st in sorted(srcrepo.store.vfs.readdir(b'', stat=True)): | ||||
if not _filterstorefile( | if not _filterstorefile( | ||||
srcrepo, dstrepo, upgrade_op.new_requirements, p, kind, st | srcrepo, dstrepo, upgrade_op.new_requirements, p, kind, st | ||||
): | ): |