##// END OF EJS Templates
upgrade: prepare code (and output) for the idea of upgrading share...
marmoute -
r49628:17eaeb06 default
parent child Browse files
Show More
@@ -108,6 +108,22 b' def upgraderepo('
108 if not enabled:
108 if not enabled:
109 touched_revlogs.discard(rl)
109 touched_revlogs.discard(rl)
110
110
111 if repo.shared():
112 unsafe_actions = set()
113 unsafe_actions.update(up_actions)
114 unsafe_actions.update(removed_actions)
115 unsafe_actions.update(optimizations)
116 unsafe_actions = [
117 a for a in unsafe_actions if not a.compatible_with_share
118 ]
119 unsafe_actions.sort(key=lambda a: a.name)
120 if unsafe_actions:
121 m = _(b'cannot use these actions on a share repository: %s')
122 h = _(b'upgrade the main repository directly')
123 actions = b', '.join(a.name for a in unsafe_actions)
124 m %= actions
125 raise error.Abort(m, hint=h)
126
111 for action in sorted(up_actions + removed_actions, key=lambda a: a.name):
127 for action in sorted(up_actions + removed_actions, key=lambda a: a.name):
112 # optimisation does not "requires anything, they just needs it.
128 # optimisation does not "requires anything, they just needs it.
113 if action.type != upgrade_actions.FORMAT_VARIANT:
129 if action.type != upgrade_actions.FORMAT_VARIANT:
@@ -36,7 +36,10 b' RECLONES_REQUIREMENTS = {'
36
36
37
37
38 def preservedrequirements(repo):
38 def preservedrequirements(repo):
39 return set()
39 preserved = {
40 requirements.SHARED_REQUIREMENT,
41 }
42 return preserved & repo.requirements
40
43
41
44
42 FORMAT_VARIANT = b'deficiency'
45 FORMAT_VARIANT = b'deficiency'
@@ -97,6 +100,9 b' class improvement(object):'
97 # Whether this improvement touches the dirstate
100 # Whether this improvement touches the dirstate
98 touches_dirstate = False
101 touches_dirstate = False
99
102
103 # Can this action be run on a share instead of its mains repository
104 compatible_with_share = False
105
100
106
101 allformatvariant = [] # type: List[Type['formatvariant']]
107 allformatvariant = [] # type: List[Type['formatvariant']]
102
108
@@ -899,8 +905,6 b' def blocksourcerequirements(repo):'
899 # This was a precursor to generaldelta and was never enabled by default.
905 # This was a precursor to generaldelta and was never enabled by default.
900 # It should (hopefully) not exist in the wild.
906 # It should (hopefully) not exist in the wild.
901 b'parentdelta',
907 b'parentdelta',
902 # Upgrade should operate on the actual store, not the shared link.
903 requirements.SHARED_REQUIREMENT,
904 }
908 }
905
909
906
910
@@ -932,6 +936,16 b' def check_source_requirements(repo):'
932 m = _(b'cannot upgrade repository; unsupported source requirement: %s')
936 m = _(b'cannot upgrade repository; unsupported source requirement: %s')
933 blockingreqs = b', '.join(sorted(blockingreqs))
937 blockingreqs = b', '.join(sorted(blockingreqs))
934 raise error.Abort(m % blockingreqs)
938 raise error.Abort(m % blockingreqs)
939 # Upgrade should operate on the actual store, not the shared link.
940
941 bad_share = (
942 requirements.SHARED_REQUIREMENT in repo.requirements
943 and requirements.SHARESAFE_REQUIREMENT not in repo.requirements
944 )
945 if bad_share:
946 m = _(b'cannot upgrade repository; share repository without share-safe')
947 h = _(b'check :hg:`help config.format.use-share-safe`')
948 raise error.Abort(m, hint=h)
935
949
936
950
937 ### Verify the validity of the planned requirement changes ####################
951 ### Verify the validity of the planned requirement changes ####################
@@ -972,18 +986,19 b' def supporteddestrequirements(repo):'
972 Extensions should monkeypatch this to add their custom requirements.
986 Extensions should monkeypatch this to add their custom requirements.
973 """
987 """
974 supported = {
988 supported = {
989 requirements.CHANGELOGV2_REQUIREMENT,
990 requirements.COPIESSDC_REQUIREMENT,
991 requirements.DIRSTATE_V2_REQUIREMENT,
975 requirements.DOTENCODE_REQUIREMENT,
992 requirements.DOTENCODE_REQUIREMENT,
976 requirements.FNCACHE_REQUIREMENT,
993 requirements.FNCACHE_REQUIREMENT,
977 requirements.GENERALDELTA_REQUIREMENT,
994 requirements.GENERALDELTA_REQUIREMENT,
995 requirements.NODEMAP_REQUIREMENT,
978 requirements.REVLOGV1_REQUIREMENT, # allowed in case of downgrade
996 requirements.REVLOGV1_REQUIREMENT, # allowed in case of downgrade
979 requirements.STORE_REQUIREMENT,
997 requirements.REVLOGV2_REQUIREMENT,
998 requirements.SHARED_REQUIREMENT,
999 requirements.SHARESAFE_REQUIREMENT,
980 requirements.SPARSEREVLOG_REQUIREMENT,
1000 requirements.SPARSEREVLOG_REQUIREMENT,
981 requirements.COPIESSDC_REQUIREMENT,
1001 requirements.STORE_REQUIREMENT,
982 requirements.NODEMAP_REQUIREMENT,
983 requirements.SHARESAFE_REQUIREMENT,
984 requirements.REVLOGV2_REQUIREMENT,
985 requirements.CHANGELOGV2_REQUIREMENT,
986 requirements.DIRSTATE_V2_REQUIREMENT,
987 }
1002 }
988 for name in compression.compengines:
1003 for name in compression.compengines:
989 engine = compression.compengines[name]
1004 engine = compression.compengines[name]
@@ -244,7 +244,8 b' Disable zstd related tests because its n'
244 $ echo "use-persistent-nodemap=True" >> .hg/hgrc
244 $ echo "use-persistent-nodemap=True" >> .hg/hgrc
245
245
246 $ hg debugupgraderepo --run -q -R ../shared1
246 $ hg debugupgraderepo --run -q -R ../shared1
247 abort: cannot upgrade repository; unsupported source requirement: shared
247 abort: cannot use these actions on a share repository: persistent-nodemap
248 (upgrade the main repository directly)
248 [255]
249 [255]
249
250
250 $ hg debugupgraderepo --run -q
251 $ hg debugupgraderepo --run -q
@@ -32,10 +32,12 b' Cannot upgrade shared repositories'
32 $ hg init share-parent
32 $ hg init share-parent
33 $ hg -q share share-parent share-child
33 $ hg -q share share-parent share-child
34
34
35 $ hg -R share-child debugupgraderepo
35 $ hg -R share-child debugupgraderepo --config format.sparse-revlog=no
36 abort: cannot upgrade repository; unsupported source requirement: shared
36 abort: cannot use these actions on a share repository: sparserevlog
37 (upgrade the main repository directly)
37 [255]
38 [255]
38
39
40
39 Do not yet support upgrading treemanifest repos
41 Do not yet support upgrading treemanifest repos
40
42
41 $ hg --config experimental.treemanifest=true init treemanifest
43 $ hg --config experimental.treemanifest=true init treemanifest
General Comments 0
You need to be logged in to leave comments. Login now