Changeset View
Changeset View
Standalone View
Standalone View
mercurial/upgrade_utils/actions.py
# upgrade.py - functions for in place upgrade of Mercurial repository | # upgrade.py - functions for in place upgrade of Mercurial repository | ||||
# | # | ||||
# Copyright (c) 2016-present, Gregory Szorc | # Copyright (c) 2016-present, Gregory Szorc | ||||
# | # | ||||
# This software may be used and distributed according to the terms of the | # This software may be used and distributed according to the terms of the | ||||
# GNU General Public License version 2 or any later version. | # GNU General Public License version 2 or any later version. | ||||
from __future__ import absolute_import | from __future__ import absolute_import | ||||
from ..i18n import _ | from ..i18n import _ | ||||
from .. import ( | from .. import ( | ||||
error, | error, | ||||
localrepo, | localrepo, | ||||
requirements, | requirements, | ||||
revlog, | |||||
util, | util, | ||||
) | ) | ||||
from ..utils import compression | from ..utils import compression | ||||
# list of requirements that request a clone of all revlog if added/removed | # list of requirements that request a clone of all revlog if added/removed | ||||
RECLONES_REQUIREMENTS = { | RECLONES_REQUIREMENTS = { | ||||
b'generaldelta', | b'generaldelta', | ||||
▲ Show 20 Lines • Show All 618 Lines • ▼ Show 20 Line(s) | ): | ||||
) | ) | ||||
# optimizations which are not used and it's recommended that they | # optimizations which are not used and it's recommended that they | ||||
# should use them | # should use them | ||||
all_optimizations = findoptimizations(None) | all_optimizations = findoptimizations(None) | ||||
self.unused_optimizations = [ | self.unused_optimizations = [ | ||||
i for i in all_optimizations if i not in self.upgrade_actions | i for i in all_optimizations if i not in self.upgrade_actions | ||||
] | ] | ||||
# delta reuse mode of this upgrade operation | |||||
self.delta_reuse_mode = revlog.revlog.DELTAREUSEALWAYS | |||||
if b're-delta-all' in self._upgrade_actions_names: | |||||
self.delta_reuse_mode = revlog.revlog.DELTAREUSENEVER | |||||
elif b're-delta-parent' in self._upgrade_actions_names: | |||||
self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS | |||||
elif b're-delta-multibase' in self._upgrade_actions_names: | |||||
self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS | |||||
elif b're-delta-fulladd' in self._upgrade_actions_names: | |||||
self.delta_reuse_mode = revlog.revlog.DELTAREUSEFULLADD | |||||
def _write_labeled(self, l, label): | def _write_labeled(self, l, label): | ||||
""" | """ | ||||
Utility function to aid writing of a list under one label | Utility function to aid writing of a list under one label | ||||
""" | """ | ||||
first = True | first = True | ||||
for r in sorted(l): | for r in sorted(l): | ||||
if not first: | if not first: | ||||
self.ui.write(b', ') | self.ui.write(b', ') | ||||
▲ Show 20 Lines • Show All 231 Lines • Show Last 20 Lines |