# HG changeset patch # User Pierre-Yves David # Date 1638788388 -3600 # Node ID 6e045497b20b0fa104f4a70b8d5df18995d5f076 # Parent 112184713852aecf9121c928aa60c9fd48fc2f47 upgrade: move the revlog selection code lower down the chain We about about to make revlog section smarter. Moving the code around will make the next changesets clearer. Differential Revision: https://phab.mercurial-scm.org/D11867 diff -r 112184713852 -r 6e045497b20b mercurial/upgrade.py --- a/mercurial/upgrade.py Thu Dec 09 10:55:17 2021 +0100 +++ b/mercurial/upgrade.py Mon Dec 06 11:59:48 2021 +0100 @@ -45,24 +45,11 @@ optimize = {} repo = repo.unfiltered() - revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS) specentries = ( (upgrade_engine.UPGRADE_CHANGELOG, changelog), (upgrade_engine.UPGRADE_MANIFEST, manifest), (upgrade_engine.UPGRADE_FILELOGS, filelogs), ) - 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 upgrade, enabled in specified: - if enabled: - revlogs.add(upgrade) - else: - # none are enabled - for upgrade, __ in specified: - revlogs.discard(upgrade) # Ensure the repository can be upgraded. upgrade_actions.check_source_requirements(repo) @@ -99,6 +86,24 @@ removedreqs = repo.requirements - newreqs addedreqs = newreqs - repo.requirements + # check if we need to touch revlog and if so, which ones + + revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS) + 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 upgrade, enabled in specified: + if enabled: + revlogs.add(upgrade) + else: + # none are enabled + for upgrade, __ in specified: + revlogs.discard(upgrade) + + # check the consistency of the revlog selection with the planned action + if revlogs != upgrade_engine.UPGRADE_ALL_REVLOGS: incompatible = upgrade_actions.RECLONES_REQUIREMENTS & ( removedreqs | addedreqs