Mercurial > hg
changeset 45981:53bde3ad0270
upgrade: directly use the upgrade action constant
This make the code simpler and will make it simpler to add more case in the
future.
Differential Revision: https://phab.mercurial-scm.org/D9467
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 30 Nov 2020 12:40:28 +0100 |
parents | fe7d7917ceb5 |
children | d26497811ed9 |
files | mercurial/upgrade.py |
diffstat | 1 files changed, 8 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/upgrade.py Mon Nov 30 12:24:36 2020 +0100 +++ b/mercurial/upgrade.py Mon Nov 30 12:40:28 2020 +0100 @@ -1154,25 +1154,22 @@ repo = repo.unfiltered() revlogs = set(UPGRADE_ALL_REVLOGS) - specentries = ((b'c', changelog), (b'm', manifest)) + specentries = ( + (UPGRADE_CHANGELOG, changelog), + (UPGRADE_MANIFEST, manifest) + ) specified = [(y, x) for (y, x) in specentries if x is not None] if specified: # we have some limitation on revlogs to be recloned if any(x for y, x in specified): revlogs = set() - for r, enabled in specified: + for upgrade, enabled in specified: if enabled: - if r == b'c': - revlogs.add(UPGRADE_CHANGELOG) - elif r == b'm': - revlogs.add(UPGRADE_MANIFEST) + revlogs.add(upgrade) else: # none are enabled - for r, __ in specified: - if r == b'c': - revlogs.discard(UPGRADE_CHANGELOG) - elif r == b'm': - revlogs.discard(UPGRADE_MANIFEST) + for upgrade, __ in specified: + revlogs.discard(upgrade) # Ensure the repository can be upgraded. missingreqs = requiredsourcerequirements(repo) - repo.requirements