mercurial/upgrade.py
author Pulkit Goyal <7895pulkit@gmail.com>
Sat, 12 Dec 2020 18:09:16 +0530
changeset 46191 aba979b1b90b
parent 46190 9ab2ab5bf9af
child 46192 25d11b24dedf
permissions -rw-r--r--
upgrade: move `printrequirements()` to UpgradeOperation class Part of refactor where we make things more arranged and integrated into single `UpgradeOperation` class. Differential Revision: https://phab.mercurial-scm.org/D9577
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31894
9379689b6c10 upgrade: update the header comment
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31893
diff changeset
     1
# upgrade.py - functions for in place upgrade of Mercurial repository
4702
18e91c9def0c strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     2
#
31895
783b4c9bd5f5 upgrade: update the copyright statement
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31894
diff changeset
     3
# Copyright (c) 2016-present, Gregory Szorc
4702
18e91c9def0c strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     4
#
8225
46293a0c7e9f updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents: 8073
diff changeset
     5
# This software may be used and distributed according to the terms of the
10263
25e572394f5c Update license to GPLv2+
Matt Mackall <mpm@selenic.com>
parents: 9150
diff changeset
     6
# GNU General Public License version 2 or any later version.
4702
18e91c9def0c strip: move strip code to a new repair module
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     7
25970
d1419cfbd4f4 repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25874
diff changeset
     8
from __future__ import absolute_import
d1419cfbd4f4 repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25874
diff changeset
     9
d1419cfbd4f4 repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25874
diff changeset
    10
from .i18n import _
d1419cfbd4f4 repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25874
diff changeset
    11
from . import (
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26425
diff changeset
    12
    error,
35343
06987c6971be upgrade: more standard creation of the temporary repository
Boris Feld <boris.feld@octobus.net>
parents: 35342
diff changeset
    13
    hg,
31893
165428b05fca upgrade: import 'localrepo' globally
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31875
diff changeset
    14
    localrepo,
38165
2ce60954b1b7 py3: wrap tempfile.mkdtemp() to use bytes path
Yuya Nishihara <yuya@tcha.org>
parents: 37444
diff changeset
    15
    pycompat,
46046
f105c49e89cd upgrade: split actual upgrade code away from the main module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46035
diff changeset
    16
)
f105c49e89cd upgrade: split actual upgrade code away from the main module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46035
diff changeset
    17
f105c49e89cd upgrade: split actual upgrade code away from the main module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46035
diff changeset
    18
from .upgrade_utils import (
46047
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
    19
    actions as upgrade_actions,
46046
f105c49e89cd upgrade: split actual upgrade code away from the main module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46035
diff changeset
    20
    engine as upgrade_engine,
25970
d1419cfbd4f4 repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25874
diff changeset
    21
)
d1419cfbd4f4 repair: use absolute_import
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25874
diff changeset
    22
46047
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
    23
allformatvariant = upgrade_actions.allformatvariant
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    24
41088
5608b5a6c323 upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents: 40997
diff changeset
    25
# search without '-' to support older form on newer client.
5608b5a6c323 upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents: 40997
diff changeset
    26
#
5608b5a6c323 upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents: 40997
diff changeset
    27
# We don't enforce backward compatibility for debug command so this
5608b5a6c323 upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents: 40997
diff changeset
    28
# might eventually be dropped. However, having to use two different
5608b5a6c323 upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents: 40997
diff changeset
    29
# forms in script when comparing result is anoying enough to add
5608b5a6c323 upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents: 40997
diff changeset
    30
# backward compatibility for a while.
5608b5a6c323 upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents: 40997
diff changeset
    31
legacy_opts_map = {
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
    32
    b'redeltaparent': b're-delta-parent',
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
    33
    b'redeltamultibase': b're-delta-multibase',
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
    34
    b'redeltaall': b're-delta-all',
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
    35
    b'redeltafulladd': b're-delta-fulladd',
41088
5608b5a6c323 upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents: 40997
diff changeset
    36
}
5608b5a6c323 upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents: 40997
diff changeset
    37
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    38
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    39
def upgraderepo(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    40
    ui,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    41
    repo,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    42
    run=False,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    43
    optimize=None,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    44
    backup=True,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    45
    manifest=None,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    46
    changelog=None,
45997
7c539f0febbe upgrade: add an explicite --filelogs arguments
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45995
diff changeset
    47
    filelogs=None,
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    48
):
30775
513d68a90398 repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30707
diff changeset
    49
    """Upgrade a repository in place."""
41088
5608b5a6c323 upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents: 40997
diff changeset
    50
    if optimize is None:
5608b5a6c323 upgrade: add '-' in optimization name
Boris Feld <boris.feld@octobus.net>
parents: 40997
diff changeset
    51
        optimize = []
44452
9d2b2df2c2ba cleanup: run pyupgrade on our source tree to clean up varying things
Augie Fackler <augie@google.com>
parents: 44382
diff changeset
    52
    optimize = {legacy_opts_map.get(o, o) for o in optimize}
30775
513d68a90398 repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30707
diff changeset
    53
    repo = repo.unfiltered()
513d68a90398 repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30707
diff changeset
    54
46046
f105c49e89cd upgrade: split actual upgrade code away from the main module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46035
diff changeset
    55
    revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS)
45981
53bde3ad0270 upgrade: directly use the upgrade action constant
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45980
diff changeset
    56
    specentries = (
46046
f105c49e89cd upgrade: split actual upgrade code away from the main module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46035
diff changeset
    57
        (upgrade_engine.UPGRADE_CHANGELOG, changelog),
f105c49e89cd upgrade: split actual upgrade code away from the main module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46035
diff changeset
    58
        (upgrade_engine.UPGRADE_MANIFEST, manifest),
f105c49e89cd upgrade: split actual upgrade code away from the main module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46035
diff changeset
    59
        (upgrade_engine.UPGRADE_FILELOGS, filelogs),
45981
53bde3ad0270 upgrade: directly use the upgrade action constant
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45980
diff changeset
    60
    )
42830
cf2b765cecd7 upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42693
diff changeset
    61
    specified = [(y, x) for (y, x) in specentries if x is not None]
cf2b765cecd7 upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42693
diff changeset
    62
    if specified:
cf2b765cecd7 upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42693
diff changeset
    63
        # we have some limitation on revlogs to be recloned
cf2b765cecd7 upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42693
diff changeset
    64
        if any(x for y, x in specified):
cf2b765cecd7 upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42693
diff changeset
    65
            revlogs = set()
45981
53bde3ad0270 upgrade: directly use the upgrade action constant
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45980
diff changeset
    66
            for upgrade, enabled in specified:
42830
cf2b765cecd7 upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42693
diff changeset
    67
                if enabled:
45981
53bde3ad0270 upgrade: directly use the upgrade action constant
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45980
diff changeset
    68
                    revlogs.add(upgrade)
42830
cf2b765cecd7 upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42693
diff changeset
    69
        else:
cf2b765cecd7 upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42693
diff changeset
    70
            # none are enabled
45981
53bde3ad0270 upgrade: directly use the upgrade action constant
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45980
diff changeset
    71
            for upgrade, __ in specified:
53bde3ad0270 upgrade: directly use the upgrade action constant
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45980
diff changeset
    72
                revlogs.discard(upgrade)
42830
cf2b765cecd7 upgrade: add an argument to control manifest upgrade
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42693
diff changeset
    73
30775
513d68a90398 repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30707
diff changeset
    74
    # Ensure the repository can be upgraded.
46048
f4f956342cf1 upgrade: move requirements checking in a dedicated function
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46047
diff changeset
    75
    upgrade_actions.check_source_requirements(repo)
30775
513d68a90398 repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30707
diff changeset
    76
46051
72b7b4bf3e65 upgrade: extract the checking of target requirements change
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46050
diff changeset
    77
    default_options = localrepo.defaultcreateopts(repo.ui)
72b7b4bf3e65 upgrade: extract the checking of target requirements change
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46050
diff changeset
    78
    newreqs = localrepo.newreporequirements(repo.ui, default_options)
46047
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
    79
    newreqs.update(upgrade_actions.preservedrequirements(repo))
30775
513d68a90398 repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30707
diff changeset
    80
46051
72b7b4bf3e65 upgrade: extract the checking of target requirements change
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46050
diff changeset
    81
    upgrade_actions.check_requirements_changes(repo, newreqs)
30775
513d68a90398 repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30707
diff changeset
    82
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
    83
    # Find and validate all improvements that can be made.
46047
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
    84
    alloptimizations = upgrade_actions.findoptimizations(repo)
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
    85
31899
cccd8e1538b0 upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31898
diff changeset
    86
    # Apply and Validate arguments.
cccd8e1538b0 upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31898
diff changeset
    87
    optimizations = []
cccd8e1538b0 upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31898
diff changeset
    88
    for o in alloptimizations:
cccd8e1538b0 upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31898
diff changeset
    89
        if o.name in optimize:
cccd8e1538b0 upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31898
diff changeset
    90
            optimizations.append(o)
cccd8e1538b0 upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31898
diff changeset
    91
            optimize.discard(o.name)
cccd8e1538b0 upgrade: filter optimizations outside of 'determineactions'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31898
diff changeset
    92
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    93
    if optimize:  # anything left is unknown
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    94
        raise error.Abort(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
    95
            _(b'unknown optimization action requested: %s')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
    96
            % b', '.join(sorted(optimize)),
43117
8ff1ecfadcd1 cleanup: join string literals that are already on one line
Martin von Zweigbergk <martinvonz@google.com>
parents: 43089
diff changeset
    97
            hint=_(b'run without arguments to see valid optimizations'),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
    98
        )
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
    99
46047
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
   100
    deficiencies = upgrade_actions.finddeficiencies(repo)
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
   101
    actions = upgrade_actions.determineactions(
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
   102
        repo, deficiencies, repo.requirements, newreqs
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
   103
    )
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   104
    actions.extend(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   105
        o
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   106
        for o in sorted(optimizations)
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   107
        # determineactions could have added optimisation
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   108
        if o not in actions
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   109
    )
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   110
42832
a3c2ffcd266f upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42831
diff changeset
   111
    removedreqs = repo.requirements - newreqs
a3c2ffcd266f upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42831
diff changeset
   112
    addedreqs = newreqs - repo.requirements
a3c2ffcd266f upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42831
diff changeset
   113
46046
f105c49e89cd upgrade: split actual upgrade code away from the main module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46035
diff changeset
   114
    if revlogs != upgrade_engine.UPGRADE_ALL_REVLOGS:
46047
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
   115
        incompatible = upgrade_actions.RECLONES_REQUIREMENTS & (
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
   116
            removedreqs | addedreqs
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
   117
        )
42832
a3c2ffcd266f upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42831
diff changeset
   118
        if incompatible:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   119
            msg = _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   120
                b'ignoring revlogs selection flags, format requirements '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   121
                b'change: %s\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   122
            )
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   123
            ui.warn(msg % b', '.join(sorted(incompatible)))
46046
f105c49e89cd upgrade: split actual upgrade code away from the main module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46035
diff changeset
   124
            revlogs = upgrade_engine.UPGRADE_ALL_REVLOGS
42832
a3c2ffcd266f upgrade: make sure we reclone all revlogs when updating to some format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42831
diff changeset
   125
46056
c407513a44a3 upgrade: start moving the "to be happening" data in a dedicated object
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46051
diff changeset
   126
    upgrade_op = upgrade_actions.UpgradeOperation(
46188
945b33a7edfd upgrade: move `print_affected_revlogs()` to UpgradeOperation class
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46056
diff changeset
   127
        ui,
46056
c407513a44a3 upgrade: start moving the "to be happening" data in a dedicated object
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46051
diff changeset
   128
        newreqs,
46191
aba979b1b90b upgrade: move `printrequirements()` to UpgradeOperation class
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46190
diff changeset
   129
        repo.requirements,
46189
dfddcbb0c244 upgrade: move `printupgradeactions()` to UpgradeOperation class
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46188
diff changeset
   130
        actions,
46056
c407513a44a3 upgrade: start moving the "to be happening" data in a dedicated object
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46051
diff changeset
   131
        revlogs,
c407513a44a3 upgrade: start moving the "to be happening" data in a dedicated object
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46051
diff changeset
   132
    )
c407513a44a3 upgrade: start moving the "to be happening" data in a dedicated object
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46051
diff changeset
   133
30775
513d68a90398 repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30707
diff changeset
   134
    if not run:
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   135
        fromconfig = []
31904
3c77f03f16b3 upgrade: simplify the "origin" dispatch in dry run
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31903
diff changeset
   136
        onlydefault = []
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   137
31901
9bdedb050d8d upgrade: simplify some of the initial dispatch for dry run
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31900
diff changeset
   138
        for d in deficiencies:
32031
11a2461fc9b1 upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32030
diff changeset
   139
            if d.fromconfig(repo):
31901
9bdedb050d8d upgrade: simplify some of the initial dispatch for dry run
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31900
diff changeset
   140
                fromconfig.append(d)
32031
11a2461fc9b1 upgrade: move descriptions and selection logic in individual classes
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 32030
diff changeset
   141
            elif d.default:
31904
3c77f03f16b3 upgrade: simplify the "origin" dispatch in dry run
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31903
diff changeset
   142
                onlydefault.append(d)
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   143
31904
3c77f03f16b3 upgrade: simplify the "origin" dispatch in dry run
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31903
diff changeset
   144
        if fromconfig or onlydefault:
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   145
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   146
            if fromconfig:
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   147
                ui.status(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   148
                    _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   149
                        b'repository lacks features recommended by '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   150
                        b'current config options:\n\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   151
                    )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   152
                )
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   153
                for i in fromconfig:
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   154
                    ui.status(b'%s\n   %s\n\n' % (i.name, i.description))
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   155
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   156
            if onlydefault:
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   157
                ui.status(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   158
                    _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   159
                        b'repository lacks features used by the default '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   160
                        b'config options:\n\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   161
                    )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   162
                )
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   163
                for i in onlydefault:
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   164
                    ui.status(b'%s\n   %s\n\n' % (i.name, i.description))
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   165
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   166
            ui.status(b'\n')
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   167
        else:
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   168
            ui.status(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   169
                _(
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   170
                    b'(no feature deficiencies found in existing '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   171
                    b'repository)\n'
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   172
                )
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   173
            )
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   174
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   175
        ui.status(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   176
            _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   177
                b'performing an upgrade with "--run" will make the following '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   178
                b'changes:\n\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   179
            )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   180
        )
30775
513d68a90398 repair: implement requirements checking for upgrades
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30707
diff changeset
   181
46191
aba979b1b90b upgrade: move `printrequirements()` to UpgradeOperation class
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46190
diff changeset
   182
        upgrade_op.print_requirements()
46190
9ab2ab5bf9af upgrade: move `printoptimisations() to UpgradeOperation class
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46189
diff changeset
   183
        upgrade_op.print_optimisations()
46189
dfddcbb0c244 upgrade: move `printupgradeactions()` to UpgradeOperation class
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46188
diff changeset
   184
        upgrade_op.print_upgrade_actions()
46188
945b33a7edfd upgrade: move `print_affected_revlogs()` to UpgradeOperation class
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46056
diff changeset
   185
        upgrade_op.print_affected_revlogs()
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   186
31903
fa1088de2119 upgrade: use 'improvement' object for action too
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31902
diff changeset
   187
        unusedoptimize = [i for i in alloptimizations if i not in actions]
fa1088de2119 upgrade: use 'improvement' object for action too
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 31902
diff changeset
   188
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   189
        if unusedoptimize:
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   190
            ui.status(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   191
                _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   192
                    b'additional optimizations are available by specifying '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   193
                    b'"--optimize <name>":\n\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   194
                )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   195
            )
30776
3997edc4a86d repair: determine what upgrade will do
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30775
diff changeset
   196
            for i in unusedoptimize:
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   197
                ui.status(_(b'%s\n   %s\n\n') % (i.name, i.description))
30777
7de7afd8bdd9 repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30776
diff changeset
   198
        return
7de7afd8bdd9 repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30776
diff changeset
   199
7de7afd8bdd9 repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30776
diff changeset
   200
    # Else we're in the run=true case.
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   201
    ui.write(_(b'upgrade will perform the following actions:\n\n'))
46191
aba979b1b90b upgrade: move `printrequirements()` to UpgradeOperation class
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46190
diff changeset
   202
    upgrade_op.print_requirements()
46190
9ab2ab5bf9af upgrade: move `printoptimisations() to UpgradeOperation class
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46189
diff changeset
   203
    upgrade_op.print_optimisations()
46189
dfddcbb0c244 upgrade: move `printupgradeactions()` to UpgradeOperation class
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46188
diff changeset
   204
    upgrade_op.print_upgrade_actions()
46188
945b33a7edfd upgrade: move `print_affected_revlogs()` to UpgradeOperation class
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46056
diff changeset
   205
    upgrade_op.print_affected_revlogs()
30777
7de7afd8bdd9 repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30776
diff changeset
   206
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   207
    ui.status(_(b'beginning upgrade...\n'))
33438
8056481caa81 codemod: simplify nested withs
Jun Wu <quark@fb.com>
parents: 32291
diff changeset
   208
    with repo.wlock(), repo.lock():
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   209
        ui.status(_(b'repository locked and read-only\n'))
33438
8056481caa81 codemod: simplify nested withs
Jun Wu <quark@fb.com>
parents: 32291
diff changeset
   210
        # Our strategy for upgrading the repository is to create a new,
8056481caa81 codemod: simplify nested withs
Jun Wu <quark@fb.com>
parents: 32291
diff changeset
   211
        # temporary repository, write data to it, then do a swap of the
8056481caa81 codemod: simplify nested withs
Jun Wu <quark@fb.com>
parents: 32291
diff changeset
   212
        # data. There are less heavyweight ways to do this, but it is easier
8056481caa81 codemod: simplify nested withs
Jun Wu <quark@fb.com>
parents: 32291
diff changeset
   213
        # to create a new repo object than to instantiate all the components
8056481caa81 codemod: simplify nested withs
Jun Wu <quark@fb.com>
parents: 32291
diff changeset
   214
        # (like the store) separately.
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   215
        tmppath = pycompat.mkdtemp(prefix=b'upgrade.', dir=repo.path)
33438
8056481caa81 codemod: simplify nested withs
Jun Wu <quark@fb.com>
parents: 32291
diff changeset
   216
        backuppath = None
8056481caa81 codemod: simplify nested withs
Jun Wu <quark@fb.com>
parents: 32291
diff changeset
   217
        try:
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   218
            ui.status(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   219
                _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   220
                    b'creating temporary repository to stage migrated '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   221
                    b'data: %s\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   222
                )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   223
                % tmppath
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   224
            )
35342
75520786ad2f upgrade: use the repository 'ui' as the base for the new repository
Boris Feld <boris.feld@octobus.net>
parents: 35340
diff changeset
   225
35379
6c28956ba2d4 upgrade: simplify workaround for repo.ui.copy()
Yuya Nishihara <yuya@tcha.org>
parents: 35345
diff changeset
   226
            # clone ui without using ui.copy because repo.ui is protected
6c28956ba2d4 upgrade: simplify workaround for repo.ui.copy()
Yuya Nishihara <yuya@tcha.org>
parents: 35345
diff changeset
   227
            repoui = repo.ui.__class__(repo.ui)
6c28956ba2d4 upgrade: simplify workaround for repo.ui.copy()
Yuya Nishihara <yuya@tcha.org>
parents: 35345
diff changeset
   228
            dstrepo = hg.repository(repoui, path=tmppath, create=True)
30777
7de7afd8bdd9 repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30776
diff changeset
   229
33438
8056481caa81 codemod: simplify nested withs
Jun Wu <quark@fb.com>
parents: 32291
diff changeset
   230
            with dstrepo.wlock(), dstrepo.lock():
46046
f105c49e89cd upgrade: split actual upgrade code away from the main module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46035
diff changeset
   231
                backuppath = upgrade_engine.upgrade(
46056
c407513a44a3 upgrade: start moving the "to be happening" data in a dedicated object
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46051
diff changeset
   232
                    ui, repo, dstrepo, upgrade_op
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   233
                )
41089
a59a74721c76 debugupgraderepo: add a --no-backup mode
Boris Feld <boris.feld@octobus.net>
parents: 41088
diff changeset
   234
            if not (backup or backuppath is None):
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   235
                ui.status(
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   236
                    _(b'removing old repository content%s\n') % backuppath
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   237
                )
41089
a59a74721c76 debugupgraderepo: add a --no-backup mode
Boris Feld <boris.feld@octobus.net>
parents: 41088
diff changeset
   238
                repo.vfs.rmtree(backuppath, forcibly=True)
a59a74721c76 debugupgraderepo: add a --no-backup mode
Boris Feld <boris.feld@octobus.net>
parents: 41088
diff changeset
   239
                backuppath = None
30777
7de7afd8bdd9 repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30776
diff changeset
   240
33438
8056481caa81 codemod: simplify nested withs
Jun Wu <quark@fb.com>
parents: 32291
diff changeset
   241
        finally:
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   242
            ui.status(_(b'removing temporary repository %s\n') % tmppath)
33438
8056481caa81 codemod: simplify nested withs
Jun Wu <quark@fb.com>
parents: 32291
diff changeset
   243
            repo.vfs.rmtree(tmppath, forcibly=True)
30777
7de7afd8bdd9 repair: begin implementation of in-place upgrading
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30776
diff changeset
   244
44798
e295ba238bd8 upgrade: support the --quiet flag
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 44797
diff changeset
   245
            if backuppath and not ui.quiet:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   246
                ui.warn(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   247
                    _(b'copy of old repository backed up at %s\n') % backuppath
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   248
                )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   249
                ui.warn(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   250
                    _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   251
                        b'the old repository will not be deleted; remove '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   252
                        b'it to free up disk space once the upgraded '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   253
                        b'repository is verified\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   254
                    )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 43031
diff changeset
   255
                )
46002
705c37f22859 upgrade: add support for experimental safe share mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45997
diff changeset
   256
46047
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
   257
            if upgrade_actions.sharesafe.name in addedreqs:
46002
705c37f22859 upgrade: add support for experimental safe share mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45997
diff changeset
   258
                ui.warn(
705c37f22859 upgrade: add support for experimental safe share mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45997
diff changeset
   259
                    _(
705c37f22859 upgrade: add support for experimental safe share mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45997
diff changeset
   260
                        b'repository upgraded to share safe mode, existing'
705c37f22859 upgrade: add support for experimental safe share mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45997
diff changeset
   261
                        b' shares will still work in old non-safe mode. '
705c37f22859 upgrade: add support for experimental safe share mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45997
diff changeset
   262
                        b'Re-share existing shares to use them in safe mode'
705c37f22859 upgrade: add support for experimental safe share mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45997
diff changeset
   263
                        b' New shares will be created in safe mode.\n'
705c37f22859 upgrade: add support for experimental safe share mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45997
diff changeset
   264
                    )
705c37f22859 upgrade: add support for experimental safe share mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45997
diff changeset
   265
                )
46047
4b89cf08d8dc upgrade: split definition and management of the actions from the main code
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46046
diff changeset
   266
            if upgrade_actions.sharesafe.name in removedreqs:
46003
c6a1fa42e325 upgrade: add support to downgrade share safe mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46002
diff changeset
   267
                ui.warn(
c6a1fa42e325 upgrade: add support to downgrade share safe mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46002
diff changeset
   268
                    _(
c6a1fa42e325 upgrade: add support to downgrade share safe mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46002
diff changeset
   269
                        b'repository downgraded to not use share safe mode, '
c6a1fa42e325 upgrade: add support to downgrade share safe mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46002
diff changeset
   270
                        b'existing shares will not work and needs to'
c6a1fa42e325 upgrade: add support to downgrade share safe mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46002
diff changeset
   271
                        b' be reshared.\n'
c6a1fa42e325 upgrade: add support to downgrade share safe mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46002
diff changeset
   272
                    )
c6a1fa42e325 upgrade: add support to downgrade share safe mode
Pulkit Goyal <7895pulkit@gmail.com>
parents: 46002
diff changeset
   273
                )