mercurial/upgrade.py
changeset 48445 e7420f75d90d
parent 48444 6e045497b20b
child 48446 1d0978cfe968
equal deleted inserted replaced
48444:6e045497b20b 48445:e7420f75d90d
    43     """Upgrade a repository in place."""
    43     """Upgrade a repository in place."""
    44     if optimize is None:
    44     if optimize is None:
    45         optimize = {}
    45         optimize = {}
    46     repo = repo.unfiltered()
    46     repo = repo.unfiltered()
    47 
    47 
    48     specentries = (
    48     specified_revlogs = {}
    49         (upgrade_engine.UPGRADE_CHANGELOG, changelog),
    49     if changelog is not None:
    50         (upgrade_engine.UPGRADE_MANIFEST, manifest),
    50         specified_revlogs[upgrade_engine.UPGRADE_CHANGELOG] = changelog
    51         (upgrade_engine.UPGRADE_FILELOGS, filelogs),
    51     if manifest is not None:
    52     )
    52         specified_revlogs[upgrade_engine.UPGRADE_MANIFEST] = manifest
       
    53     if filelogs is not None:
       
    54         specified_revlogs[upgrade_engine.UPGRADE_FILELOGS] = filelogs
    53 
    55 
    54     # Ensure the repository can be upgraded.
    56     # Ensure the repository can be upgraded.
    55     upgrade_actions.check_source_requirements(repo)
    57     upgrade_actions.check_source_requirements(repo)
    56 
    58 
    57     default_options = localrepo.defaultcreateopts(repo.ui)
    59     default_options = localrepo.defaultcreateopts(repo.ui)
    87     addedreqs = newreqs - repo.requirements
    89     addedreqs = newreqs - repo.requirements
    88 
    90 
    89     # check if we need to touch revlog and if so, which ones
    91     # check if we need to touch revlog and if so, which ones
    90 
    92 
    91     revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS)
    93     revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS)
    92     specified = [(y, x) for (y, x) in specentries if x is not None]
    94     if specified_revlogs:
    93     if specified:
       
    94         # we have some limitation on revlogs to be recloned
    95         # we have some limitation on revlogs to be recloned
    95         if any(x for y, x in specified):
    96         if any(specified_revlogs.values()):
    96             revlogs = set()
    97             revlogs = set()
    97             for upgrade, enabled in specified:
    98             for upgrade, enabled in specified_revlogs.items():
    98                 if enabled:
    99                 if enabled:
    99                     revlogs.add(upgrade)
   100                     revlogs.add(upgrade)
   100         else:
   101         else:
   101             # none are enabled
   102             # none are enabled
   102             for upgrade, __ in specified:
   103             for upgrade in specified_revlogs.keys():
   103                 revlogs.discard(upgrade)
   104                 revlogs.discard(upgrade)
   104 
   105 
   105     # check the consistency of the revlog selection with the planned action
   106     # check the consistency of the revlog selection with the planned action
   106 
   107 
   107     if revlogs != upgrade_engine.UPGRADE_ALL_REVLOGS:
   108     if revlogs != upgrade_engine.UPGRADE_ALL_REVLOGS: