# HG changeset patch # User Pierre-Yves David # Date 2021-12-07 10:36:16 # Node ID d46cf894f586641185797adcec6bf1aac307f35e # Parent 6e4999cb085e5597e1dd19cda42b1b21664876cf touches_wc_requirements diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -94,6 +94,9 @@ class improvement(object): # Whether this improvement changes repository requirements touches_requirements = True + # Whether this improvement changes working copy requirements + touches_wc_requirements = True + # Whether this improvement touches the dirstate touches_dirstate = False @@ -188,7 +191,8 @@ class dirstatev2(requirementformatvarian touches_filelogs = False touches_manifests = False touches_changelog = False - touches_requirements = True + touches_requirements = False + touches_wc_requirements = True touches_dirstate = True @@ -719,10 +723,24 @@ class UpgradeOperation(object): return set([a.name for a in self.upgrade_actions]) @property + def wc_requirements_only(self): + # does the operation only touches repository requirement + return ( + self.touches_wc_requirements + and not self.touches_requirements + and not self.touches_filelogs + and not self.touches_manifests + and not self.touches_changelog + and not self.touches_dirstate + ) + + @property def requirements_only(self): # does the operation only touches repository requirement return ( - self.touches_requirements + (self.touches_requirements + or self.touches_wc_requirements + ) and not self.touches_filelogs and not self.touches_manifests and not self.touches_changelog @@ -769,6 +787,19 @@ class UpgradeOperation(object): return False @property + def touches_wc_requirements(self): + for a in self.upgrade_actions: + # optimisations are used to re-process revlogs and does not result + # in a requirement being added or removed + if a.type == OPTIMISATION: + pass + elif a.touches_wc_requirements: + return True + for a in self.removed_actions: + if a.touches_wc_requirements: + return True + + @property def touches_requirements(self): for a in self.upgrade_actions: # optimisations are used to re-process revlogs and does not result