##// 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
@@ -1,401 +1,417 b''
1 # upgrade.py - functions for in place upgrade of Mercurial repository
1 # upgrade.py - functions for in place upgrade of Mercurial repository
2 #
2 #
3 # Copyright (c) 2016-present, Gregory Szorc
3 # Copyright (c) 2016-present, Gregory Szorc
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 from .i18n import _
10 from .i18n import _
11 from . import (
11 from . import (
12 error,
12 error,
13 hg,
13 hg,
14 localrepo,
14 localrepo,
15 lock as lockmod,
15 lock as lockmod,
16 pycompat,
16 pycompat,
17 requirements as requirementsmod,
17 requirements as requirementsmod,
18 scmutil,
18 scmutil,
19 )
19 )
20
20
21 from .upgrade_utils import (
21 from .upgrade_utils import (
22 actions as upgrade_actions,
22 actions as upgrade_actions,
23 engine as upgrade_engine,
23 engine as upgrade_engine,
24 )
24 )
25
25
26 from .utils import (
26 from .utils import (
27 stringutil,
27 stringutil,
28 )
28 )
29
29
30 allformatvariant = upgrade_actions.allformatvariant
30 allformatvariant = upgrade_actions.allformatvariant
31
31
32
32
33 def upgraderepo(
33 def upgraderepo(
34 ui,
34 ui,
35 repo,
35 repo,
36 run=False,
36 run=False,
37 optimize=None,
37 optimize=None,
38 backup=True,
38 backup=True,
39 manifest=None,
39 manifest=None,
40 changelog=None,
40 changelog=None,
41 filelogs=None,
41 filelogs=None,
42 ):
42 ):
43 """Upgrade a repository in place."""
43 """Upgrade a repository in place."""
44 if optimize is None:
44 if optimize is None:
45 optimize = set()
45 optimize = set()
46 repo = repo.unfiltered()
46 repo = repo.unfiltered()
47
47
48 specified_revlogs = {}
48 specified_revlogs = {}
49 if changelog is not None:
49 if changelog is not None:
50 specified_revlogs[upgrade_engine.UPGRADE_CHANGELOG] = changelog
50 specified_revlogs[upgrade_engine.UPGRADE_CHANGELOG] = changelog
51 if manifest is not None:
51 if manifest is not None:
52 specified_revlogs[upgrade_engine.UPGRADE_MANIFEST] = manifest
52 specified_revlogs[upgrade_engine.UPGRADE_MANIFEST] = manifest
53 if filelogs is not None:
53 if filelogs is not None:
54 specified_revlogs[upgrade_engine.UPGRADE_FILELOGS] = filelogs
54 specified_revlogs[upgrade_engine.UPGRADE_FILELOGS] = filelogs
55
55
56 # Ensure the repository can be upgraded.
56 # Ensure the repository can be upgraded.
57 upgrade_actions.check_source_requirements(repo)
57 upgrade_actions.check_source_requirements(repo)
58
58
59 default_options = localrepo.defaultcreateopts(repo.ui)
59 default_options = localrepo.defaultcreateopts(repo.ui)
60 newreqs = localrepo.newreporequirements(repo.ui, default_options)
60 newreqs = localrepo.newreporequirements(repo.ui, default_options)
61 newreqs.update(upgrade_actions.preservedrequirements(repo))
61 newreqs.update(upgrade_actions.preservedrequirements(repo))
62
62
63 upgrade_actions.check_requirements_changes(repo, newreqs)
63 upgrade_actions.check_requirements_changes(repo, newreqs)
64
64
65 # Find and validate all improvements that can be made.
65 # Find and validate all improvements that can be made.
66 alloptimizations = upgrade_actions.findoptimizations(repo)
66 alloptimizations = upgrade_actions.findoptimizations(repo)
67
67
68 # Apply and Validate arguments.
68 # Apply and Validate arguments.
69 optimizations = []
69 optimizations = []
70 for o in alloptimizations:
70 for o in alloptimizations:
71 if o.name in optimize:
71 if o.name in optimize:
72 optimizations.append(o)
72 optimizations.append(o)
73 optimize.discard(o.name)
73 optimize.discard(o.name)
74
74
75 if optimize: # anything left is unknown
75 if optimize: # anything left is unknown
76 raise error.Abort(
76 raise error.Abort(
77 _(b'unknown optimization action requested: %s')
77 _(b'unknown optimization action requested: %s')
78 % b', '.join(sorted(optimize)),
78 % b', '.join(sorted(optimize)),
79 hint=_(b'run without arguments to see valid optimizations'),
79 hint=_(b'run without arguments to see valid optimizations'),
80 )
80 )
81
81
82 format_upgrades = upgrade_actions.find_format_upgrades(repo)
82 format_upgrades = upgrade_actions.find_format_upgrades(repo)
83 up_actions = upgrade_actions.determine_upgrade_actions(
83 up_actions = upgrade_actions.determine_upgrade_actions(
84 repo, format_upgrades, optimizations, repo.requirements, newreqs
84 repo, format_upgrades, optimizations, repo.requirements, newreqs
85 )
85 )
86 removed_actions = upgrade_actions.find_format_downgrades(repo)
86 removed_actions = upgrade_actions.find_format_downgrades(repo)
87
87
88 # check if we need to touch revlog and if so, which ones
88 # check if we need to touch revlog and if so, which ones
89
89
90 touched_revlogs = set()
90 touched_revlogs = set()
91 overwrite_msg = _(b'warning: ignoring %14s, as upgrade is changing: %s\n')
91 overwrite_msg = _(b'warning: ignoring %14s, as upgrade is changing: %s\n')
92 select_msg = _(b'note: selecting %s for processing to change: %s\n')
92 select_msg = _(b'note: selecting %s for processing to change: %s\n')
93 msg_issued = 0
93 msg_issued = 0
94
94
95 FL = upgrade_engine.UPGRADE_FILELOGS
95 FL = upgrade_engine.UPGRADE_FILELOGS
96 MN = upgrade_engine.UPGRADE_MANIFEST
96 MN = upgrade_engine.UPGRADE_MANIFEST
97 CL = upgrade_engine.UPGRADE_CHANGELOG
97 CL = upgrade_engine.UPGRADE_CHANGELOG
98
98
99 if optimizations:
99 if optimizations:
100 if any(specified_revlogs.values()):
100 if any(specified_revlogs.values()):
101 # we have some limitation on revlogs to be recloned
101 # we have some limitation on revlogs to be recloned
102 for rl, enabled in specified_revlogs.items():
102 for rl, enabled in specified_revlogs.items():
103 if enabled:
103 if enabled:
104 touched_revlogs.add(rl)
104 touched_revlogs.add(rl)
105 else:
105 else:
106 touched_revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS)
106 touched_revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS)
107 for rl, enabled in specified_revlogs.items():
107 for rl, enabled in specified_revlogs.items():
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:
114 continue
130 continue
115
131
116 if action.touches_filelogs and FL not in touched_revlogs:
132 if action.touches_filelogs and FL not in touched_revlogs:
117 if FL in specified_revlogs:
133 if FL in specified_revlogs:
118 if not specified_revlogs[FL]:
134 if not specified_revlogs[FL]:
119 msg = overwrite_msg % (b'--no-filelogs', action.name)
135 msg = overwrite_msg % (b'--no-filelogs', action.name)
120 ui.warn(msg)
136 ui.warn(msg)
121 msg_issued = 2
137 msg_issued = 2
122 else:
138 else:
123 msg = select_msg % (b'all-filelogs', action.name)
139 msg = select_msg % (b'all-filelogs', action.name)
124 ui.status(msg)
140 ui.status(msg)
125 if not ui.quiet:
141 if not ui.quiet:
126 msg_issued = 1
142 msg_issued = 1
127 touched_revlogs.add(FL)
143 touched_revlogs.add(FL)
128
144
129 if action.touches_manifests and MN not in touched_revlogs:
145 if action.touches_manifests and MN not in touched_revlogs:
130 if MN in specified_revlogs:
146 if MN in specified_revlogs:
131 if not specified_revlogs[MN]:
147 if not specified_revlogs[MN]:
132 msg = overwrite_msg % (b'--no-manifest', action.name)
148 msg = overwrite_msg % (b'--no-manifest', action.name)
133 ui.warn(msg)
149 ui.warn(msg)
134 msg_issued = 2
150 msg_issued = 2
135 else:
151 else:
136 msg = select_msg % (b'all-manifestlogs', action.name)
152 msg = select_msg % (b'all-manifestlogs', action.name)
137 ui.status(msg)
153 ui.status(msg)
138 if not ui.quiet:
154 if not ui.quiet:
139 msg_issued = 1
155 msg_issued = 1
140 touched_revlogs.add(MN)
156 touched_revlogs.add(MN)
141
157
142 if action.touches_changelog and CL not in touched_revlogs:
158 if action.touches_changelog and CL not in touched_revlogs:
143 if CL in specified_revlogs:
159 if CL in specified_revlogs:
144 if not specified_revlogs[CL]:
160 if not specified_revlogs[CL]:
145 msg = overwrite_msg % (b'--no-changelog', action.name)
161 msg = overwrite_msg % (b'--no-changelog', action.name)
146 ui.warn(msg)
162 ui.warn(msg)
147 msg_issued = True
163 msg_issued = True
148 else:
164 else:
149 msg = select_msg % (b'changelog', action.name)
165 msg = select_msg % (b'changelog', action.name)
150 ui.status(msg)
166 ui.status(msg)
151 if not ui.quiet:
167 if not ui.quiet:
152 msg_issued = 1
168 msg_issued = 1
153 touched_revlogs.add(CL)
169 touched_revlogs.add(CL)
154 if msg_issued >= 2:
170 if msg_issued >= 2:
155 ui.warn((b"\n"))
171 ui.warn((b"\n"))
156 elif msg_issued >= 1:
172 elif msg_issued >= 1:
157 ui.status((b"\n"))
173 ui.status((b"\n"))
158
174
159 upgrade_op = upgrade_actions.UpgradeOperation(
175 upgrade_op = upgrade_actions.UpgradeOperation(
160 ui,
176 ui,
161 newreqs,
177 newreqs,
162 repo.requirements,
178 repo.requirements,
163 up_actions,
179 up_actions,
164 removed_actions,
180 removed_actions,
165 touched_revlogs,
181 touched_revlogs,
166 backup,
182 backup,
167 )
183 )
168
184
169 if not run:
185 if not run:
170 fromconfig = []
186 fromconfig = []
171 onlydefault = []
187 onlydefault = []
172
188
173 for d in format_upgrades:
189 for d in format_upgrades:
174 if d.fromconfig(repo):
190 if d.fromconfig(repo):
175 fromconfig.append(d)
191 fromconfig.append(d)
176 elif d.default:
192 elif d.default:
177 onlydefault.append(d)
193 onlydefault.append(d)
178
194
179 if fromconfig or onlydefault:
195 if fromconfig or onlydefault:
180
196
181 if fromconfig:
197 if fromconfig:
182 ui.status(
198 ui.status(
183 _(
199 _(
184 b'repository lacks features recommended by '
200 b'repository lacks features recommended by '
185 b'current config options:\n\n'
201 b'current config options:\n\n'
186 )
202 )
187 )
203 )
188 for i in fromconfig:
204 for i in fromconfig:
189 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
205 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
190
206
191 if onlydefault:
207 if onlydefault:
192 ui.status(
208 ui.status(
193 _(
209 _(
194 b'repository lacks features used by the default '
210 b'repository lacks features used by the default '
195 b'config options:\n\n'
211 b'config options:\n\n'
196 )
212 )
197 )
213 )
198 for i in onlydefault:
214 for i in onlydefault:
199 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
215 ui.status(b'%s\n %s\n\n' % (i.name, i.description))
200
216
201 ui.status(b'\n')
217 ui.status(b'\n')
202 else:
218 else:
203 ui.status(_(b'(no format upgrades found in existing repository)\n'))
219 ui.status(_(b'(no format upgrades found in existing repository)\n'))
204
220
205 ui.status(
221 ui.status(
206 _(
222 _(
207 b'performing an upgrade with "--run" will make the following '
223 b'performing an upgrade with "--run" will make the following '
208 b'changes:\n\n'
224 b'changes:\n\n'
209 )
225 )
210 )
226 )
211
227
212 upgrade_op.print_requirements()
228 upgrade_op.print_requirements()
213 upgrade_op.print_optimisations()
229 upgrade_op.print_optimisations()
214 upgrade_op.print_upgrade_actions()
230 upgrade_op.print_upgrade_actions()
215 upgrade_op.print_affected_revlogs()
231 upgrade_op.print_affected_revlogs()
216
232
217 if upgrade_op.unused_optimizations:
233 if upgrade_op.unused_optimizations:
218 ui.status(
234 ui.status(
219 _(
235 _(
220 b'additional optimizations are available by specifying '
236 b'additional optimizations are available by specifying '
221 b'"--optimize <name>":\n\n'
237 b'"--optimize <name>":\n\n'
222 )
238 )
223 )
239 )
224 upgrade_op.print_unused_optimizations()
240 upgrade_op.print_unused_optimizations()
225 return
241 return
226
242
227 if not (upgrade_op.upgrade_actions or upgrade_op.removed_actions):
243 if not (upgrade_op.upgrade_actions or upgrade_op.removed_actions):
228 ui.status(_(b'nothing to do\n'))
244 ui.status(_(b'nothing to do\n'))
229 return
245 return
230 # Else we're in the run=true case.
246 # Else we're in the run=true case.
231 ui.write(_(b'upgrade will perform the following actions:\n\n'))
247 ui.write(_(b'upgrade will perform the following actions:\n\n'))
232 upgrade_op.print_requirements()
248 upgrade_op.print_requirements()
233 upgrade_op.print_optimisations()
249 upgrade_op.print_optimisations()
234 upgrade_op.print_upgrade_actions()
250 upgrade_op.print_upgrade_actions()
235 upgrade_op.print_affected_revlogs()
251 upgrade_op.print_affected_revlogs()
236
252
237 ui.status(_(b'beginning upgrade...\n'))
253 ui.status(_(b'beginning upgrade...\n'))
238 with repo.wlock(), repo.lock():
254 with repo.wlock(), repo.lock():
239 ui.status(_(b'repository locked and read-only\n'))
255 ui.status(_(b'repository locked and read-only\n'))
240 # Our strategy for upgrading the repository is to create a new,
256 # Our strategy for upgrading the repository is to create a new,
241 # temporary repository, write data to it, then do a swap of the
257 # temporary repository, write data to it, then do a swap of the
242 # data. There are less heavyweight ways to do this, but it is easier
258 # data. There are less heavyweight ways to do this, but it is easier
243 # to create a new repo object than to instantiate all the components
259 # to create a new repo object than to instantiate all the components
244 # (like the store) separately.
260 # (like the store) separately.
245 tmppath = pycompat.mkdtemp(prefix=b'upgrade.', dir=repo.path)
261 tmppath = pycompat.mkdtemp(prefix=b'upgrade.', dir=repo.path)
246 backuppath = None
262 backuppath = None
247 try:
263 try:
248 ui.status(
264 ui.status(
249 _(
265 _(
250 b'creating temporary repository to stage upgraded '
266 b'creating temporary repository to stage upgraded '
251 b'data: %s\n'
267 b'data: %s\n'
252 )
268 )
253 % tmppath
269 % tmppath
254 )
270 )
255
271
256 # clone ui without using ui.copy because repo.ui is protected
272 # clone ui without using ui.copy because repo.ui is protected
257 repoui = repo.ui.__class__(repo.ui)
273 repoui = repo.ui.__class__(repo.ui)
258 dstrepo = hg.repository(repoui, path=tmppath, create=True)
274 dstrepo = hg.repository(repoui, path=tmppath, create=True)
259
275
260 with dstrepo.wlock(), dstrepo.lock():
276 with dstrepo.wlock(), dstrepo.lock():
261 backuppath = upgrade_engine.upgrade(
277 backuppath = upgrade_engine.upgrade(
262 ui, repo, dstrepo, upgrade_op
278 ui, repo, dstrepo, upgrade_op
263 )
279 )
264
280
265 finally:
281 finally:
266 ui.status(_(b'removing temporary repository %s\n') % tmppath)
282 ui.status(_(b'removing temporary repository %s\n') % tmppath)
267 repo.vfs.rmtree(tmppath, forcibly=True)
283 repo.vfs.rmtree(tmppath, forcibly=True)
268
284
269 if backuppath and not ui.quiet:
285 if backuppath and not ui.quiet:
270 ui.warn(
286 ui.warn(
271 _(b'copy of old repository backed up at %s\n') % backuppath
287 _(b'copy of old repository backed up at %s\n') % backuppath
272 )
288 )
273 ui.warn(
289 ui.warn(
274 _(
290 _(
275 b'the old repository will not be deleted; remove '
291 b'the old repository will not be deleted; remove '
276 b'it to free up disk space once the upgraded '
292 b'it to free up disk space once the upgraded '
277 b'repository is verified\n'
293 b'repository is verified\n'
278 )
294 )
279 )
295 )
280
296
281 upgrade_op.print_post_op_messages()
297 upgrade_op.print_post_op_messages()
282
298
283
299
284 def upgrade_share_to_safe(
300 def upgrade_share_to_safe(
285 ui,
301 ui,
286 hgvfs,
302 hgvfs,
287 storevfs,
303 storevfs,
288 current_requirements,
304 current_requirements,
289 mismatch_config,
305 mismatch_config,
290 mismatch_warn,
306 mismatch_warn,
291 ):
307 ):
292 """Upgrades a share to use share-safe mechanism"""
308 """Upgrades a share to use share-safe mechanism"""
293 wlock = None
309 wlock = None
294 store_requirements = localrepo._readrequires(storevfs, False)
310 store_requirements = localrepo._readrequires(storevfs, False)
295 original_crequirements = current_requirements.copy()
311 original_crequirements = current_requirements.copy()
296 # after upgrade, store requires will be shared, so lets find
312 # after upgrade, store requires will be shared, so lets find
297 # the requirements which are not present in store and
313 # the requirements which are not present in store and
298 # write them to share's .hg/requires
314 # write them to share's .hg/requires
299 diffrequires = current_requirements - store_requirements
315 diffrequires = current_requirements - store_requirements
300 # add share-safe requirement as it will mark the share as share-safe
316 # add share-safe requirement as it will mark the share as share-safe
301 diffrequires.add(requirementsmod.SHARESAFE_REQUIREMENT)
317 diffrequires.add(requirementsmod.SHARESAFE_REQUIREMENT)
302 current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT)
318 current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT)
303 # in `allow` case, we don't try to upgrade, we just respect the source
319 # in `allow` case, we don't try to upgrade, we just respect the source
304 # state, update requirements and continue
320 # state, update requirements and continue
305 if mismatch_config == b'allow':
321 if mismatch_config == b'allow':
306 return
322 return
307 try:
323 try:
308 wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0)
324 wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0)
309 # some process might change the requirement in between, re-read
325 # some process might change the requirement in between, re-read
310 # and update current_requirements
326 # and update current_requirements
311 locked_requirements = localrepo._readrequires(hgvfs, True)
327 locked_requirements = localrepo._readrequires(hgvfs, True)
312 if locked_requirements != original_crequirements:
328 if locked_requirements != original_crequirements:
313 removed = current_requirements - locked_requirements
329 removed = current_requirements - locked_requirements
314 # update current_requirements in place because it's passed
330 # update current_requirements in place because it's passed
315 # as reference
331 # as reference
316 current_requirements -= removed
332 current_requirements -= removed
317 current_requirements |= locked_requirements
333 current_requirements |= locked_requirements
318 diffrequires = current_requirements - store_requirements
334 diffrequires = current_requirements - store_requirements
319 # add share-safe requirement as it will mark the share as share-safe
335 # add share-safe requirement as it will mark the share as share-safe
320 diffrequires.add(requirementsmod.SHARESAFE_REQUIREMENT)
336 diffrequires.add(requirementsmod.SHARESAFE_REQUIREMENT)
321 current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT)
337 current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT)
322 scmutil.writerequires(hgvfs, diffrequires)
338 scmutil.writerequires(hgvfs, diffrequires)
323 ui.warn(_(b'repository upgraded to use share-safe mode\n'))
339 ui.warn(_(b'repository upgraded to use share-safe mode\n'))
324 except error.LockError as e:
340 except error.LockError as e:
325 hint = _(
341 hint = _(
326 b"see `hg help config.format.use-share-safe` for more information"
342 b"see `hg help config.format.use-share-safe` for more information"
327 )
343 )
328 if mismatch_config == b'upgrade-abort':
344 if mismatch_config == b'upgrade-abort':
329 raise error.Abort(
345 raise error.Abort(
330 _(b'failed to upgrade share, got error: %s')
346 _(b'failed to upgrade share, got error: %s')
331 % stringutil.forcebytestr(e.strerror),
347 % stringutil.forcebytestr(e.strerror),
332 hint=hint,
348 hint=hint,
333 )
349 )
334 elif mismatch_warn:
350 elif mismatch_warn:
335 ui.warn(
351 ui.warn(
336 _(b'failed to upgrade share, got error: %s\n')
352 _(b'failed to upgrade share, got error: %s\n')
337 % stringutil.forcebytestr(e.strerror),
353 % stringutil.forcebytestr(e.strerror),
338 hint=hint,
354 hint=hint,
339 )
355 )
340 finally:
356 finally:
341 if wlock:
357 if wlock:
342 wlock.release()
358 wlock.release()
343
359
344
360
345 def downgrade_share_to_non_safe(
361 def downgrade_share_to_non_safe(
346 ui,
362 ui,
347 hgvfs,
363 hgvfs,
348 sharedvfs,
364 sharedvfs,
349 current_requirements,
365 current_requirements,
350 mismatch_config,
366 mismatch_config,
351 mismatch_warn,
367 mismatch_warn,
352 ):
368 ):
353 """Downgrades a share which use share-safe to not use it"""
369 """Downgrades a share which use share-safe to not use it"""
354 wlock = None
370 wlock = None
355 source_requirements = localrepo._readrequires(sharedvfs, True)
371 source_requirements = localrepo._readrequires(sharedvfs, True)
356 original_crequirements = current_requirements.copy()
372 original_crequirements = current_requirements.copy()
357 # we cannot be 100% sure on which requirements were present in store when
373 # we cannot be 100% sure on which requirements were present in store when
358 # the source supported share-safe. However, we do know that working
374 # the source supported share-safe. However, we do know that working
359 # directory requirements were not there. Hence we remove them
375 # directory requirements were not there. Hence we remove them
360 source_requirements -= requirementsmod.WORKING_DIR_REQUIREMENTS
376 source_requirements -= requirementsmod.WORKING_DIR_REQUIREMENTS
361 current_requirements |= source_requirements
377 current_requirements |= source_requirements
362 current_requirements.remove(requirementsmod.SHARESAFE_REQUIREMENT)
378 current_requirements.remove(requirementsmod.SHARESAFE_REQUIREMENT)
363 if mismatch_config == b'allow':
379 if mismatch_config == b'allow':
364 return
380 return
365
381
366 try:
382 try:
367 wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0)
383 wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0)
368 # some process might change the requirement in between, re-read
384 # some process might change the requirement in between, re-read
369 # and update current_requirements
385 # and update current_requirements
370 locked_requirements = localrepo._readrequires(hgvfs, True)
386 locked_requirements = localrepo._readrequires(hgvfs, True)
371 if locked_requirements != original_crequirements:
387 if locked_requirements != original_crequirements:
372 removed = current_requirements - locked_requirements
388 removed = current_requirements - locked_requirements
373 # update current_requirements in place because it's passed
389 # update current_requirements in place because it's passed
374 # as reference
390 # as reference
375 current_requirements -= removed
391 current_requirements -= removed
376 current_requirements |= locked_requirements
392 current_requirements |= locked_requirements
377 current_requirements |= source_requirements
393 current_requirements |= source_requirements
378 current_requirements -= set(requirementsmod.SHARESAFE_REQUIREMENT)
394 current_requirements -= set(requirementsmod.SHARESAFE_REQUIREMENT)
379 scmutil.writerequires(hgvfs, current_requirements)
395 scmutil.writerequires(hgvfs, current_requirements)
380 ui.warn(_(b'repository downgraded to not use share-safe mode\n'))
396 ui.warn(_(b'repository downgraded to not use share-safe mode\n'))
381 except error.LockError as e:
397 except error.LockError as e:
382 hint = _(
398 hint = _(
383 b"see `hg help config.format.use-share-safe` for more information"
399 b"see `hg help config.format.use-share-safe` for more information"
384 )
400 )
385 # If upgrade-abort is set, abort when upgrade fails, else let the
401 # If upgrade-abort is set, abort when upgrade fails, else let the
386 # process continue as `upgrade-allow` is set
402 # process continue as `upgrade-allow` is set
387 if mismatch_config == b'downgrade-abort':
403 if mismatch_config == b'downgrade-abort':
388 raise error.Abort(
404 raise error.Abort(
389 _(b'failed to downgrade share, got error: %s')
405 _(b'failed to downgrade share, got error: %s')
390 % stringutil.forcebytestr(e.strerror),
406 % stringutil.forcebytestr(e.strerror),
391 hint=hint,
407 hint=hint,
392 )
408 )
393 elif mismatch_warn:
409 elif mismatch_warn:
394 ui.warn(
410 ui.warn(
395 _(b'failed to downgrade share, got error: %s\n')
411 _(b'failed to downgrade share, got error: %s\n')
396 % stringutil.forcebytestr(e.strerror),
412 % stringutil.forcebytestr(e.strerror),
397 hint=hint,
413 hint=hint,
398 )
414 )
399 finally:
415 finally:
400 if wlock:
416 if wlock:
401 wlock.release()
417 wlock.release()
@@ -1,1054 +1,1069 b''
1 # upgrade.py - functions for in place upgrade of Mercurial repository
1 # upgrade.py - functions for in place upgrade of Mercurial repository
2 #
2 #
3 # Copyright (c) 2016-present, Gregory Szorc
3 # Copyright (c) 2016-present, Gregory Szorc
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 from ..i18n import _
10 from ..i18n import _
11 from .. import (
11 from .. import (
12 error,
12 error,
13 localrepo,
13 localrepo,
14 pycompat,
14 pycompat,
15 requirements,
15 requirements,
16 revlog,
16 revlog,
17 util,
17 util,
18 )
18 )
19
19
20 from ..utils import compression
20 from ..utils import compression
21
21
22 if pycompat.TYPE_CHECKING:
22 if pycompat.TYPE_CHECKING:
23 from typing import (
23 from typing import (
24 List,
24 List,
25 Type,
25 Type,
26 )
26 )
27
27
28
28
29 # list of requirements that request a clone of all revlog if added/removed
29 # list of requirements that request a clone of all revlog if added/removed
30 RECLONES_REQUIREMENTS = {
30 RECLONES_REQUIREMENTS = {
31 requirements.GENERALDELTA_REQUIREMENT,
31 requirements.GENERALDELTA_REQUIREMENT,
32 requirements.SPARSEREVLOG_REQUIREMENT,
32 requirements.SPARSEREVLOG_REQUIREMENT,
33 requirements.REVLOGV2_REQUIREMENT,
33 requirements.REVLOGV2_REQUIREMENT,
34 requirements.CHANGELOGV2_REQUIREMENT,
34 requirements.CHANGELOGV2_REQUIREMENT,
35 }
35 }
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'
43 OPTIMISATION = b'optimization'
46 OPTIMISATION = b'optimization'
44
47
45
48
46 class improvement(object):
49 class improvement(object):
47 """Represents an improvement that can be made as part of an upgrade."""
50 """Represents an improvement that can be made as part of an upgrade."""
48
51
49 ### The following attributes should be defined for each subclass:
52 ### The following attributes should be defined for each subclass:
50
53
51 # Either ``FORMAT_VARIANT`` or ``OPTIMISATION``.
54 # Either ``FORMAT_VARIANT`` or ``OPTIMISATION``.
52 # A format variant is where we change the storage format. Not all format
55 # A format variant is where we change the storage format. Not all format
53 # variant changes are an obvious problem.
56 # variant changes are an obvious problem.
54 # An optimization is an action (sometimes optional) that
57 # An optimization is an action (sometimes optional) that
55 # can be taken to further improve the state of the repository.
58 # can be taken to further improve the state of the repository.
56 type = None
59 type = None
57
60
58 # machine-readable string uniquely identifying this improvement. it will be
61 # machine-readable string uniquely identifying this improvement. it will be
59 # mapped to an action later in the upgrade process.
62 # mapped to an action later in the upgrade process.
60 name = None
63 name = None
61
64
62 # message intended for humans explaining the improvement in more detail,
65 # message intended for humans explaining the improvement in more detail,
63 # including the implications of it ``FORMAT_VARIANT`` types, should be
66 # including the implications of it ``FORMAT_VARIANT`` types, should be
64 # worded
67 # worded
65 # in the present tense.
68 # in the present tense.
66 description = None
69 description = None
67
70
68 # message intended for humans explaining what an upgrade addressing this
71 # message intended for humans explaining what an upgrade addressing this
69 # issue will do. should be worded in the future tense.
72 # issue will do. should be worded in the future tense.
70 upgrademessage = None
73 upgrademessage = None
71
74
72 # value of current Mercurial default for new repository
75 # value of current Mercurial default for new repository
73 default = None
76 default = None
74
77
75 # Message intended for humans which will be shown post an upgrade
78 # Message intended for humans which will be shown post an upgrade
76 # operation when the improvement will be added
79 # operation when the improvement will be added
77 postupgrademessage = None
80 postupgrademessage = None
78
81
79 # Message intended for humans which will be shown post an upgrade
82 # Message intended for humans which will be shown post an upgrade
80 # operation in which this improvement was removed
83 # operation in which this improvement was removed
81 postdowngrademessage = None
84 postdowngrademessage = None
82
85
83 # By default we assume that every improvement touches requirements and all revlogs
86 # By default we assume that every improvement touches requirements and all revlogs
84
87
85 # Whether this improvement touches filelogs
88 # Whether this improvement touches filelogs
86 touches_filelogs = True
89 touches_filelogs = True
87
90
88 # Whether this improvement touches manifests
91 # Whether this improvement touches manifests
89 touches_manifests = True
92 touches_manifests = True
90
93
91 # Whether this improvement touches changelog
94 # Whether this improvement touches changelog
92 touches_changelog = True
95 touches_changelog = True
93
96
94 # Whether this improvement changes repository requirements
97 # Whether this improvement changes repository requirements
95 touches_requirements = True
98 touches_requirements = True
96
99
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
103
109
104 def registerformatvariant(cls):
110 def registerformatvariant(cls):
105 allformatvariant.append(cls)
111 allformatvariant.append(cls)
106 return cls
112 return cls
107
113
108
114
109 class formatvariant(improvement):
115 class formatvariant(improvement):
110 """an improvement subclass dedicated to repository format"""
116 """an improvement subclass dedicated to repository format"""
111
117
112 type = FORMAT_VARIANT
118 type = FORMAT_VARIANT
113
119
114 @staticmethod
120 @staticmethod
115 def fromrepo(repo):
121 def fromrepo(repo):
116 """current value of the variant in the repository"""
122 """current value of the variant in the repository"""
117 raise NotImplementedError()
123 raise NotImplementedError()
118
124
119 @staticmethod
125 @staticmethod
120 def fromconfig(repo):
126 def fromconfig(repo):
121 """current value of the variant in the configuration"""
127 """current value of the variant in the configuration"""
122 raise NotImplementedError()
128 raise NotImplementedError()
123
129
124
130
125 class requirementformatvariant(formatvariant):
131 class requirementformatvariant(formatvariant):
126 """formatvariant based on a 'requirement' name.
132 """formatvariant based on a 'requirement' name.
127
133
128 Many format variant are controlled by a 'requirement'. We define a small
134 Many format variant are controlled by a 'requirement'. We define a small
129 subclass to factor the code.
135 subclass to factor the code.
130 """
136 """
131
137
132 # the requirement that control this format variant
138 # the requirement that control this format variant
133 _requirement = None
139 _requirement = None
134
140
135 @staticmethod
141 @staticmethod
136 def _newreporequirements(ui):
142 def _newreporequirements(ui):
137 return localrepo.newreporequirements(
143 return localrepo.newreporequirements(
138 ui, localrepo.defaultcreateopts(ui)
144 ui, localrepo.defaultcreateopts(ui)
139 )
145 )
140
146
141 @classmethod
147 @classmethod
142 def fromrepo(cls, repo):
148 def fromrepo(cls, repo):
143 assert cls._requirement is not None
149 assert cls._requirement is not None
144 return cls._requirement in repo.requirements
150 return cls._requirement in repo.requirements
145
151
146 @classmethod
152 @classmethod
147 def fromconfig(cls, repo):
153 def fromconfig(cls, repo):
148 assert cls._requirement is not None
154 assert cls._requirement is not None
149 return cls._requirement in cls._newreporequirements(repo.ui)
155 return cls._requirement in cls._newreporequirements(repo.ui)
150
156
151
157
152 @registerformatvariant
158 @registerformatvariant
153 class fncache(requirementformatvariant):
159 class fncache(requirementformatvariant):
154 name = b'fncache'
160 name = b'fncache'
155
161
156 _requirement = requirements.FNCACHE_REQUIREMENT
162 _requirement = requirements.FNCACHE_REQUIREMENT
157
163
158 default = True
164 default = True
159
165
160 description = _(
166 description = _(
161 b'long and reserved filenames may not work correctly; '
167 b'long and reserved filenames may not work correctly; '
162 b'repository performance is sub-optimal'
168 b'repository performance is sub-optimal'
163 )
169 )
164
170
165 upgrademessage = _(
171 upgrademessage = _(
166 b'repository will be more resilient to storing '
172 b'repository will be more resilient to storing '
167 b'certain paths and performance of certain '
173 b'certain paths and performance of certain '
168 b'operations should be improved'
174 b'operations should be improved'
169 )
175 )
170
176
171
177
172 @registerformatvariant
178 @registerformatvariant
173 class dirstatev2(requirementformatvariant):
179 class dirstatev2(requirementformatvariant):
174 name = b'dirstate-v2'
180 name = b'dirstate-v2'
175 _requirement = requirements.DIRSTATE_V2_REQUIREMENT
181 _requirement = requirements.DIRSTATE_V2_REQUIREMENT
176
182
177 default = False
183 default = False
178
184
179 description = _(
185 description = _(
180 b'version 1 of the dirstate file format requires '
186 b'version 1 of the dirstate file format requires '
181 b'reading and parsing it all at once.\n'
187 b'reading and parsing it all at once.\n'
182 b'Version 2 has a better structure,'
188 b'Version 2 has a better structure,'
183 b'better information and lighter update mechanism'
189 b'better information and lighter update mechanism'
184 )
190 )
185
191
186 upgrademessage = _(b'"hg status" will be faster')
192 upgrademessage = _(b'"hg status" will be faster')
187
193
188 touches_filelogs = False
194 touches_filelogs = False
189 touches_manifests = False
195 touches_manifests = False
190 touches_changelog = False
196 touches_changelog = False
191 touches_requirements = True
197 touches_requirements = True
192 touches_dirstate = True
198 touches_dirstate = True
193
199
194
200
195 @registerformatvariant
201 @registerformatvariant
196 class dotencode(requirementformatvariant):
202 class dotencode(requirementformatvariant):
197 name = b'dotencode'
203 name = b'dotencode'
198
204
199 _requirement = requirements.DOTENCODE_REQUIREMENT
205 _requirement = requirements.DOTENCODE_REQUIREMENT
200
206
201 default = True
207 default = True
202
208
203 description = _(
209 description = _(
204 b'storage of filenames beginning with a period or '
210 b'storage of filenames beginning with a period or '
205 b'space may not work correctly'
211 b'space may not work correctly'
206 )
212 )
207
213
208 upgrademessage = _(
214 upgrademessage = _(
209 b'repository will be better able to store files '
215 b'repository will be better able to store files '
210 b'beginning with a space or period'
216 b'beginning with a space or period'
211 )
217 )
212
218
213
219
214 @registerformatvariant
220 @registerformatvariant
215 class generaldelta(requirementformatvariant):
221 class generaldelta(requirementformatvariant):
216 name = b'generaldelta'
222 name = b'generaldelta'
217
223
218 _requirement = requirements.GENERALDELTA_REQUIREMENT
224 _requirement = requirements.GENERALDELTA_REQUIREMENT
219
225
220 default = True
226 default = True
221
227
222 description = _(
228 description = _(
223 b'deltas within internal storage are unable to '
229 b'deltas within internal storage are unable to '
224 b'choose optimal revisions; repository is larger and '
230 b'choose optimal revisions; repository is larger and '
225 b'slower than it could be; interaction with other '
231 b'slower than it could be; interaction with other '
226 b'repositories may require extra network and CPU '
232 b'repositories may require extra network and CPU '
227 b'resources, making "hg push" and "hg pull" slower'
233 b'resources, making "hg push" and "hg pull" slower'
228 )
234 )
229
235
230 upgrademessage = _(
236 upgrademessage = _(
231 b'repository storage will be able to create '
237 b'repository storage will be able to create '
232 b'optimal deltas; new repository data will be '
238 b'optimal deltas; new repository data will be '
233 b'smaller and read times should decrease; '
239 b'smaller and read times should decrease; '
234 b'interacting with other repositories using this '
240 b'interacting with other repositories using this '
235 b'storage model should require less network and '
241 b'storage model should require less network and '
236 b'CPU resources, making "hg push" and "hg pull" '
242 b'CPU resources, making "hg push" and "hg pull" '
237 b'faster'
243 b'faster'
238 )
244 )
239
245
240
246
241 @registerformatvariant
247 @registerformatvariant
242 class sharesafe(requirementformatvariant):
248 class sharesafe(requirementformatvariant):
243 name = b'share-safe'
249 name = b'share-safe'
244 _requirement = requirements.SHARESAFE_REQUIREMENT
250 _requirement = requirements.SHARESAFE_REQUIREMENT
245
251
246 default = True
252 default = True
247
253
248 description = _(
254 description = _(
249 b'old shared repositories do not share source repository '
255 b'old shared repositories do not share source repository '
250 b'requirements and config. This leads to various problems '
256 b'requirements and config. This leads to various problems '
251 b'when the source repository format is upgraded or some new '
257 b'when the source repository format is upgraded or some new '
252 b'extensions are enabled.'
258 b'extensions are enabled.'
253 )
259 )
254
260
255 upgrademessage = _(
261 upgrademessage = _(
256 b'Upgrades a repository to share-safe format so that future '
262 b'Upgrades a repository to share-safe format so that future '
257 b'shares of this repository share its requirements and configs.'
263 b'shares of this repository share its requirements and configs.'
258 )
264 )
259
265
260 postdowngrademessage = _(
266 postdowngrademessage = _(
261 b'repository downgraded to not use share safe mode, '
267 b'repository downgraded to not use share safe mode, '
262 b'existing shares will not work and needs to'
268 b'existing shares will not work and needs to'
263 b' be reshared.'
269 b' be reshared.'
264 )
270 )
265
271
266 postupgrademessage = _(
272 postupgrademessage = _(
267 b'repository upgraded to share safe mode, existing'
273 b'repository upgraded to share safe mode, existing'
268 b' shares will still work in old non-safe mode. '
274 b' shares will still work in old non-safe mode. '
269 b'Re-share existing shares to use them in safe mode'
275 b'Re-share existing shares to use them in safe mode'
270 b' New shares will be created in safe mode.'
276 b' New shares will be created in safe mode.'
271 )
277 )
272
278
273 # upgrade only needs to change the requirements
279 # upgrade only needs to change the requirements
274 touches_filelogs = False
280 touches_filelogs = False
275 touches_manifests = False
281 touches_manifests = False
276 touches_changelog = False
282 touches_changelog = False
277 touches_requirements = True
283 touches_requirements = True
278
284
279
285
280 @registerformatvariant
286 @registerformatvariant
281 class sparserevlog(requirementformatvariant):
287 class sparserevlog(requirementformatvariant):
282 name = b'sparserevlog'
288 name = b'sparserevlog'
283
289
284 _requirement = requirements.SPARSEREVLOG_REQUIREMENT
290 _requirement = requirements.SPARSEREVLOG_REQUIREMENT
285
291
286 default = True
292 default = True
287
293
288 description = _(
294 description = _(
289 b'in order to limit disk reading and memory usage on older '
295 b'in order to limit disk reading and memory usage on older '
290 b'version, the span of a delta chain from its root to its '
296 b'version, the span of a delta chain from its root to its '
291 b'end is limited, whatever the relevant data in this span. '
297 b'end is limited, whatever the relevant data in this span. '
292 b'This can severly limit Mercurial ability to build good '
298 b'This can severly limit Mercurial ability to build good '
293 b'chain of delta resulting is much more storage space being '
299 b'chain of delta resulting is much more storage space being '
294 b'taken and limit reusability of on disk delta during '
300 b'taken and limit reusability of on disk delta during '
295 b'exchange.'
301 b'exchange.'
296 )
302 )
297
303
298 upgrademessage = _(
304 upgrademessage = _(
299 b'Revlog supports delta chain with more unused data '
305 b'Revlog supports delta chain with more unused data '
300 b'between payload. These gaps will be skipped at read '
306 b'between payload. These gaps will be skipped at read '
301 b'time. This allows for better delta chains, making a '
307 b'time. This allows for better delta chains, making a '
302 b'better compression and faster exchange with server.'
308 b'better compression and faster exchange with server.'
303 )
309 )
304
310
305
311
306 @registerformatvariant
312 @registerformatvariant
307 class persistentnodemap(requirementformatvariant):
313 class persistentnodemap(requirementformatvariant):
308 name = b'persistent-nodemap'
314 name = b'persistent-nodemap'
309
315
310 _requirement = requirements.NODEMAP_REQUIREMENT
316 _requirement = requirements.NODEMAP_REQUIREMENT
311
317
312 default = False
318 default = False
313
319
314 description = _(
320 description = _(
315 b'persist the node -> rev mapping on disk to speedup lookup'
321 b'persist the node -> rev mapping on disk to speedup lookup'
316 )
322 )
317
323
318 upgrademessage = _(b'Speedup revision lookup by node id.')
324 upgrademessage = _(b'Speedup revision lookup by node id.')
319
325
320
326
321 @registerformatvariant
327 @registerformatvariant
322 class copiessdc(requirementformatvariant):
328 class copiessdc(requirementformatvariant):
323 name = b'copies-sdc'
329 name = b'copies-sdc'
324
330
325 _requirement = requirements.COPIESSDC_REQUIREMENT
331 _requirement = requirements.COPIESSDC_REQUIREMENT
326
332
327 default = False
333 default = False
328
334
329 description = _(b'Stores copies information alongside changesets.')
335 description = _(b'Stores copies information alongside changesets.')
330
336
331 upgrademessage = _(
337 upgrademessage = _(
332 b'Allows to use more efficient algorithm to deal with ' b'copy tracing.'
338 b'Allows to use more efficient algorithm to deal with ' b'copy tracing.'
333 )
339 )
334
340
335
341
336 @registerformatvariant
342 @registerformatvariant
337 class revlogv2(requirementformatvariant):
343 class revlogv2(requirementformatvariant):
338 name = b'revlog-v2'
344 name = b'revlog-v2'
339 _requirement = requirements.REVLOGV2_REQUIREMENT
345 _requirement = requirements.REVLOGV2_REQUIREMENT
340 default = False
346 default = False
341 description = _(b'Version 2 of the revlog.')
347 description = _(b'Version 2 of the revlog.')
342 upgrademessage = _(b'very experimental')
348 upgrademessage = _(b'very experimental')
343
349
344
350
345 @registerformatvariant
351 @registerformatvariant
346 class changelogv2(requirementformatvariant):
352 class changelogv2(requirementformatvariant):
347 name = b'changelog-v2'
353 name = b'changelog-v2'
348 _requirement = requirements.CHANGELOGV2_REQUIREMENT
354 _requirement = requirements.CHANGELOGV2_REQUIREMENT
349 default = False
355 default = False
350 description = _(b'An iteration of the revlog focussed on changelog needs.')
356 description = _(b'An iteration of the revlog focussed on changelog needs.')
351 upgrademessage = _(b'quite experimental')
357 upgrademessage = _(b'quite experimental')
352
358
353
359
354 @registerformatvariant
360 @registerformatvariant
355 class removecldeltachain(formatvariant):
361 class removecldeltachain(formatvariant):
356 name = b'plain-cl-delta'
362 name = b'plain-cl-delta'
357
363
358 default = True
364 default = True
359
365
360 description = _(
366 description = _(
361 b'changelog storage is using deltas instead of '
367 b'changelog storage is using deltas instead of '
362 b'raw entries; changelog reading and any '
368 b'raw entries; changelog reading and any '
363 b'operation relying on changelog data are slower '
369 b'operation relying on changelog data are slower '
364 b'than they could be'
370 b'than they could be'
365 )
371 )
366
372
367 upgrademessage = _(
373 upgrademessage = _(
368 b'changelog storage will be reformated to '
374 b'changelog storage will be reformated to '
369 b'store raw entries; changelog reading will be '
375 b'store raw entries; changelog reading will be '
370 b'faster; changelog size may be reduced'
376 b'faster; changelog size may be reduced'
371 )
377 )
372
378
373 @staticmethod
379 @staticmethod
374 def fromrepo(repo):
380 def fromrepo(repo):
375 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
381 # Mercurial 4.0 changed changelogs to not use delta chains. Search for
376 # changelogs with deltas.
382 # changelogs with deltas.
377 cl = repo.changelog
383 cl = repo.changelog
378 chainbase = cl.chainbase
384 chainbase = cl.chainbase
379 return all(rev == chainbase(rev) for rev in cl)
385 return all(rev == chainbase(rev) for rev in cl)
380
386
381 @staticmethod
387 @staticmethod
382 def fromconfig(repo):
388 def fromconfig(repo):
383 return True
389 return True
384
390
385
391
386 _has_zstd = (
392 _has_zstd = (
387 b'zstd' in util.compengines
393 b'zstd' in util.compengines
388 and util.compengines[b'zstd'].available()
394 and util.compengines[b'zstd'].available()
389 and util.compengines[b'zstd'].revlogheader()
395 and util.compengines[b'zstd'].revlogheader()
390 )
396 )
391
397
392
398
393 @registerformatvariant
399 @registerformatvariant
394 class compressionengine(formatvariant):
400 class compressionengine(formatvariant):
395 name = b'compression'
401 name = b'compression'
396
402
397 if _has_zstd:
403 if _has_zstd:
398 default = b'zstd'
404 default = b'zstd'
399 else:
405 else:
400 default = b'zlib'
406 default = b'zlib'
401
407
402 description = _(
408 description = _(
403 b'Compresion algorithm used to compress data. '
409 b'Compresion algorithm used to compress data. '
404 b'Some engine are faster than other'
410 b'Some engine are faster than other'
405 )
411 )
406
412
407 upgrademessage = _(
413 upgrademessage = _(
408 b'revlog content will be recompressed with the new algorithm.'
414 b'revlog content will be recompressed with the new algorithm.'
409 )
415 )
410
416
411 @classmethod
417 @classmethod
412 def fromrepo(cls, repo):
418 def fromrepo(cls, repo):
413 # we allow multiple compression engine requirement to co-exist because
419 # we allow multiple compression engine requirement to co-exist because
414 # strickly speaking, revlog seems to support mixed compression style.
420 # strickly speaking, revlog seems to support mixed compression style.
415 #
421 #
416 # The compression used for new entries will be "the last one"
422 # The compression used for new entries will be "the last one"
417 compression = b'zlib'
423 compression = b'zlib'
418 for req in repo.requirements:
424 for req in repo.requirements:
419 prefix = req.startswith
425 prefix = req.startswith
420 if prefix(b'revlog-compression-') or prefix(b'exp-compression-'):
426 if prefix(b'revlog-compression-') or prefix(b'exp-compression-'):
421 compression = req.split(b'-', 2)[2]
427 compression = req.split(b'-', 2)[2]
422 return compression
428 return compression
423
429
424 @classmethod
430 @classmethod
425 def fromconfig(cls, repo):
431 def fromconfig(cls, repo):
426 compengines = repo.ui.configlist(b'format', b'revlog-compression')
432 compengines = repo.ui.configlist(b'format', b'revlog-compression')
427 # return the first valid value as the selection code would do
433 # return the first valid value as the selection code would do
428 for comp in compengines:
434 for comp in compengines:
429 if comp in util.compengines:
435 if comp in util.compengines:
430 e = util.compengines[comp]
436 e = util.compengines[comp]
431 if e.available() and e.revlogheader():
437 if e.available() and e.revlogheader():
432 return comp
438 return comp
433
439
434 # no valide compression found lets display it all for clarity
440 # no valide compression found lets display it all for clarity
435 return b','.join(compengines)
441 return b','.join(compengines)
436
442
437
443
438 @registerformatvariant
444 @registerformatvariant
439 class compressionlevel(formatvariant):
445 class compressionlevel(formatvariant):
440 name = b'compression-level'
446 name = b'compression-level'
441 default = b'default'
447 default = b'default'
442
448
443 description = _(b'compression level')
449 description = _(b'compression level')
444
450
445 upgrademessage = _(b'revlog content will be recompressed')
451 upgrademessage = _(b'revlog content will be recompressed')
446
452
447 @classmethod
453 @classmethod
448 def fromrepo(cls, repo):
454 def fromrepo(cls, repo):
449 comp = compressionengine.fromrepo(repo)
455 comp = compressionengine.fromrepo(repo)
450 level = None
456 level = None
451 if comp == b'zlib':
457 if comp == b'zlib':
452 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
458 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
453 elif comp == b'zstd':
459 elif comp == b'zstd':
454 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
460 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
455 if level is None:
461 if level is None:
456 return b'default'
462 return b'default'
457 return bytes(level)
463 return bytes(level)
458
464
459 @classmethod
465 @classmethod
460 def fromconfig(cls, repo):
466 def fromconfig(cls, repo):
461 comp = compressionengine.fromconfig(repo)
467 comp = compressionengine.fromconfig(repo)
462 level = None
468 level = None
463 if comp == b'zlib':
469 if comp == b'zlib':
464 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
470 level = repo.ui.configint(b'storage', b'revlog.zlib.level')
465 elif comp == b'zstd':
471 elif comp == b'zstd':
466 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
472 level = repo.ui.configint(b'storage', b'revlog.zstd.level')
467 if level is None:
473 if level is None:
468 return b'default'
474 return b'default'
469 return bytes(level)
475 return bytes(level)
470
476
471
477
472 def find_format_upgrades(repo):
478 def find_format_upgrades(repo):
473 """returns a list of format upgrades which can be perform on the repo"""
479 """returns a list of format upgrades which can be perform on the repo"""
474 upgrades = []
480 upgrades = []
475
481
476 # We could detect lack of revlogv1 and store here, but they were added
482 # We could detect lack of revlogv1 and store here, but they were added
477 # in 0.9.2 and we don't support upgrading repos without these
483 # in 0.9.2 and we don't support upgrading repos without these
478 # requirements, so let's not bother.
484 # requirements, so let's not bother.
479
485
480 for fv in allformatvariant:
486 for fv in allformatvariant:
481 if not fv.fromrepo(repo):
487 if not fv.fromrepo(repo):
482 upgrades.append(fv)
488 upgrades.append(fv)
483
489
484 return upgrades
490 return upgrades
485
491
486
492
487 def find_format_downgrades(repo):
493 def find_format_downgrades(repo):
488 """returns a list of format downgrades which will be performed on the repo
494 """returns a list of format downgrades which will be performed on the repo
489 because of disabled config option for them"""
495 because of disabled config option for them"""
490
496
491 downgrades = []
497 downgrades = []
492
498
493 for fv in allformatvariant:
499 for fv in allformatvariant:
494 if fv.name == b'compression':
500 if fv.name == b'compression':
495 # If there is a compression change between repository
501 # If there is a compression change between repository
496 # and config, destination repository compression will change
502 # and config, destination repository compression will change
497 # and current compression will be removed.
503 # and current compression will be removed.
498 if fv.fromrepo(repo) != fv.fromconfig(repo):
504 if fv.fromrepo(repo) != fv.fromconfig(repo):
499 downgrades.append(fv)
505 downgrades.append(fv)
500 continue
506 continue
501 # format variant exist in repo but does not exist in new repository
507 # format variant exist in repo but does not exist in new repository
502 # config
508 # config
503 if fv.fromrepo(repo) and not fv.fromconfig(repo):
509 if fv.fromrepo(repo) and not fv.fromconfig(repo):
504 downgrades.append(fv)
510 downgrades.append(fv)
505
511
506 return downgrades
512 return downgrades
507
513
508
514
509 ALL_OPTIMISATIONS = []
515 ALL_OPTIMISATIONS = []
510
516
511
517
512 def register_optimization(obj):
518 def register_optimization(obj):
513 ALL_OPTIMISATIONS.append(obj)
519 ALL_OPTIMISATIONS.append(obj)
514 return obj
520 return obj
515
521
516
522
517 class optimization(improvement):
523 class optimization(improvement):
518 """an improvement subclass dedicated to optimizations"""
524 """an improvement subclass dedicated to optimizations"""
519
525
520 type = OPTIMISATION
526 type = OPTIMISATION
521
527
522
528
523 @register_optimization
529 @register_optimization
524 class redeltaparents(optimization):
530 class redeltaparents(optimization):
525 name = b're-delta-parent'
531 name = b're-delta-parent'
526
532
527 type = OPTIMISATION
533 type = OPTIMISATION
528
534
529 description = _(
535 description = _(
530 b'deltas within internal storage will be recalculated to '
536 b'deltas within internal storage will be recalculated to '
531 b'choose an optimal base revision where this was not '
537 b'choose an optimal base revision where this was not '
532 b'already done; the size of the repository may shrink and '
538 b'already done; the size of the repository may shrink and '
533 b'various operations may become faster; the first time '
539 b'various operations may become faster; the first time '
534 b'this optimization is performed could slow down upgrade '
540 b'this optimization is performed could slow down upgrade '
535 b'execution considerably; subsequent invocations should '
541 b'execution considerably; subsequent invocations should '
536 b'not run noticeably slower'
542 b'not run noticeably slower'
537 )
543 )
538
544
539 upgrademessage = _(
545 upgrademessage = _(
540 b'deltas within internal storage will choose a new '
546 b'deltas within internal storage will choose a new '
541 b'base revision if needed'
547 b'base revision if needed'
542 )
548 )
543
549
544
550
545 @register_optimization
551 @register_optimization
546 class redeltamultibase(optimization):
552 class redeltamultibase(optimization):
547 name = b're-delta-multibase'
553 name = b're-delta-multibase'
548
554
549 type = OPTIMISATION
555 type = OPTIMISATION
550
556
551 description = _(
557 description = _(
552 b'deltas within internal storage will be recalculated '
558 b'deltas within internal storage will be recalculated '
553 b'against multiple base revision and the smallest '
559 b'against multiple base revision and the smallest '
554 b'difference will be used; the size of the repository may '
560 b'difference will be used; the size of the repository may '
555 b'shrink significantly when there are many merges; this '
561 b'shrink significantly when there are many merges; this '
556 b'optimization will slow down execution in proportion to '
562 b'optimization will slow down execution in proportion to '
557 b'the number of merges in the repository and the amount '
563 b'the number of merges in the repository and the amount '
558 b'of files in the repository; this slow down should not '
564 b'of files in the repository; this slow down should not '
559 b'be significant unless there are tens of thousands of '
565 b'be significant unless there are tens of thousands of '
560 b'files and thousands of merges'
566 b'files and thousands of merges'
561 )
567 )
562
568
563 upgrademessage = _(
569 upgrademessage = _(
564 b'deltas within internal storage will choose an '
570 b'deltas within internal storage will choose an '
565 b'optimal delta by computing deltas against multiple '
571 b'optimal delta by computing deltas against multiple '
566 b'parents; may slow down execution time '
572 b'parents; may slow down execution time '
567 b'significantly'
573 b'significantly'
568 )
574 )
569
575
570
576
571 @register_optimization
577 @register_optimization
572 class redeltaall(optimization):
578 class redeltaall(optimization):
573 name = b're-delta-all'
579 name = b're-delta-all'
574
580
575 type = OPTIMISATION
581 type = OPTIMISATION
576
582
577 description = _(
583 description = _(
578 b'deltas within internal storage will always be '
584 b'deltas within internal storage will always be '
579 b'recalculated without reusing prior deltas; this will '
585 b'recalculated without reusing prior deltas; this will '
580 b'likely make execution run several times slower; this '
586 b'likely make execution run several times slower; this '
581 b'optimization is typically not needed'
587 b'optimization is typically not needed'
582 )
588 )
583
589
584 upgrademessage = _(
590 upgrademessage = _(
585 b'deltas within internal storage will be fully '
591 b'deltas within internal storage will be fully '
586 b'recomputed; this will likely drastically slow down '
592 b'recomputed; this will likely drastically slow down '
587 b'execution time'
593 b'execution time'
588 )
594 )
589
595
590
596
591 @register_optimization
597 @register_optimization
592 class redeltafulladd(optimization):
598 class redeltafulladd(optimization):
593 name = b're-delta-fulladd'
599 name = b're-delta-fulladd'
594
600
595 type = OPTIMISATION
601 type = OPTIMISATION
596
602
597 description = _(
603 description = _(
598 b'every revision will be re-added as if it was new '
604 b'every revision will be re-added as if it was new '
599 b'content. It will go through the full storage '
605 b'content. It will go through the full storage '
600 b'mechanism giving extensions a chance to process it '
606 b'mechanism giving extensions a chance to process it '
601 b'(eg. lfs). This is similar to "re-delta-all" but even '
607 b'(eg. lfs). This is similar to "re-delta-all" but even '
602 b'slower since more logic is involved.'
608 b'slower since more logic is involved.'
603 )
609 )
604
610
605 upgrademessage = _(
611 upgrademessage = _(
606 b'each revision will be added as new content to the '
612 b'each revision will be added as new content to the '
607 b'internal storage; this will likely drastically slow '
613 b'internal storage; this will likely drastically slow '
608 b'down execution time, but some extensions might need '
614 b'down execution time, but some extensions might need '
609 b'it'
615 b'it'
610 )
616 )
611
617
612
618
613 def findoptimizations(repo):
619 def findoptimizations(repo):
614 """Determine optimisation that could be used during upgrade"""
620 """Determine optimisation that could be used during upgrade"""
615 # These are unconditionally added. There is logic later that figures out
621 # These are unconditionally added. There is logic later that figures out
616 # which ones to apply.
622 # which ones to apply.
617 return list(ALL_OPTIMISATIONS)
623 return list(ALL_OPTIMISATIONS)
618
624
619
625
620 def determine_upgrade_actions(
626 def determine_upgrade_actions(
621 repo, format_upgrades, optimizations, sourcereqs, destreqs
627 repo, format_upgrades, optimizations, sourcereqs, destreqs
622 ):
628 ):
623 """Determine upgrade actions that will be performed.
629 """Determine upgrade actions that will be performed.
624
630
625 Given a list of improvements as returned by ``find_format_upgrades`` and
631 Given a list of improvements as returned by ``find_format_upgrades`` and
626 ``findoptimizations``, determine the list of upgrade actions that
632 ``findoptimizations``, determine the list of upgrade actions that
627 will be performed.
633 will be performed.
628
634
629 The role of this function is to filter improvements if needed, apply
635 The role of this function is to filter improvements if needed, apply
630 recommended optimizations from the improvements list that make sense,
636 recommended optimizations from the improvements list that make sense,
631 etc.
637 etc.
632
638
633 Returns a list of action names.
639 Returns a list of action names.
634 """
640 """
635 newactions = []
641 newactions = []
636
642
637 for d in format_upgrades:
643 for d in format_upgrades:
638 if util.safehasattr(d, '_requirement'):
644 if util.safehasattr(d, '_requirement'):
639 name = d._requirement
645 name = d._requirement
640 else:
646 else:
641 name = None
647 name = None
642
648
643 # If the action is a requirement that doesn't show up in the
649 # If the action is a requirement that doesn't show up in the
644 # destination requirements, prune the action.
650 # destination requirements, prune the action.
645 if name is not None and name not in destreqs:
651 if name is not None and name not in destreqs:
646 continue
652 continue
647
653
648 newactions.append(d)
654 newactions.append(d)
649
655
650 newactions.extend(o for o in sorted(optimizations) if o not in newactions)
656 newactions.extend(o for o in sorted(optimizations) if o not in newactions)
651
657
652 # FUTURE consider adding some optimizations here for certain transitions.
658 # FUTURE consider adding some optimizations here for certain transitions.
653 # e.g. adding generaldelta could schedule parent redeltas.
659 # e.g. adding generaldelta could schedule parent redeltas.
654
660
655 return newactions
661 return newactions
656
662
657
663
658 class UpgradeOperation(object):
664 class UpgradeOperation(object):
659 """represent the work to be done during an upgrade"""
665 """represent the work to be done during an upgrade"""
660
666
661 def __init__(
667 def __init__(
662 self,
668 self,
663 ui,
669 ui,
664 new_requirements,
670 new_requirements,
665 current_requirements,
671 current_requirements,
666 upgrade_actions,
672 upgrade_actions,
667 removed_actions,
673 removed_actions,
668 revlogs_to_process,
674 revlogs_to_process,
669 backup_store,
675 backup_store,
670 ):
676 ):
671 self.ui = ui
677 self.ui = ui
672 self.new_requirements = new_requirements
678 self.new_requirements = new_requirements
673 self.current_requirements = current_requirements
679 self.current_requirements = current_requirements
674 # list of upgrade actions the operation will perform
680 # list of upgrade actions the operation will perform
675 self.upgrade_actions = upgrade_actions
681 self.upgrade_actions = upgrade_actions
676 self.removed_actions = removed_actions
682 self.removed_actions = removed_actions
677 self.revlogs_to_process = revlogs_to_process
683 self.revlogs_to_process = revlogs_to_process
678 # requirements which will be added by the operation
684 # requirements which will be added by the operation
679 self._added_requirements = (
685 self._added_requirements = (
680 self.new_requirements - self.current_requirements
686 self.new_requirements - self.current_requirements
681 )
687 )
682 # requirements which will be removed by the operation
688 # requirements which will be removed by the operation
683 self._removed_requirements = (
689 self._removed_requirements = (
684 self.current_requirements - self.new_requirements
690 self.current_requirements - self.new_requirements
685 )
691 )
686 # requirements which will be preserved by the operation
692 # requirements which will be preserved by the operation
687 self._preserved_requirements = (
693 self._preserved_requirements = (
688 self.current_requirements & self.new_requirements
694 self.current_requirements & self.new_requirements
689 )
695 )
690 # optimizations which are not used and it's recommended that they
696 # optimizations which are not used and it's recommended that they
691 # should use them
697 # should use them
692 all_optimizations = findoptimizations(None)
698 all_optimizations = findoptimizations(None)
693 self.unused_optimizations = [
699 self.unused_optimizations = [
694 i for i in all_optimizations if i not in self.upgrade_actions
700 i for i in all_optimizations if i not in self.upgrade_actions
695 ]
701 ]
696
702
697 # delta reuse mode of this upgrade operation
703 # delta reuse mode of this upgrade operation
698 upgrade_actions_names = self.upgrade_actions_names
704 upgrade_actions_names = self.upgrade_actions_names
699 self.delta_reuse_mode = revlog.revlog.DELTAREUSEALWAYS
705 self.delta_reuse_mode = revlog.revlog.DELTAREUSEALWAYS
700 if b're-delta-all' in upgrade_actions_names:
706 if b're-delta-all' in upgrade_actions_names:
701 self.delta_reuse_mode = revlog.revlog.DELTAREUSENEVER
707 self.delta_reuse_mode = revlog.revlog.DELTAREUSENEVER
702 elif b're-delta-parent' in upgrade_actions_names:
708 elif b're-delta-parent' in upgrade_actions_names:
703 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
709 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
704 elif b're-delta-multibase' in upgrade_actions_names:
710 elif b're-delta-multibase' in upgrade_actions_names:
705 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
711 self.delta_reuse_mode = revlog.revlog.DELTAREUSESAMEREVS
706 elif b're-delta-fulladd' in upgrade_actions_names:
712 elif b're-delta-fulladd' in upgrade_actions_names:
707 self.delta_reuse_mode = revlog.revlog.DELTAREUSEFULLADD
713 self.delta_reuse_mode = revlog.revlog.DELTAREUSEFULLADD
708
714
709 # should this operation force re-delta of both parents
715 # should this operation force re-delta of both parents
710 self.force_re_delta_both_parents = (
716 self.force_re_delta_both_parents = (
711 b're-delta-multibase' in upgrade_actions_names
717 b're-delta-multibase' in upgrade_actions_names
712 )
718 )
713
719
714 # should this operation create a backup of the store
720 # should this operation create a backup of the store
715 self.backup_store = backup_store
721 self.backup_store = backup_store
716
722
717 @property
723 @property
718 def upgrade_actions_names(self):
724 def upgrade_actions_names(self):
719 return set([a.name for a in self.upgrade_actions])
725 return set([a.name for a in self.upgrade_actions])
720
726
721 @property
727 @property
722 def requirements_only(self):
728 def requirements_only(self):
723 # does the operation only touches repository requirement
729 # does the operation only touches repository requirement
724 return (
730 return (
725 self.touches_requirements
731 self.touches_requirements
726 and not self.touches_filelogs
732 and not self.touches_filelogs
727 and not self.touches_manifests
733 and not self.touches_manifests
728 and not self.touches_changelog
734 and not self.touches_changelog
729 and not self.touches_dirstate
735 and not self.touches_dirstate
730 )
736 )
731
737
732 @property
738 @property
733 def touches_filelogs(self):
739 def touches_filelogs(self):
734 for a in self.upgrade_actions:
740 for a in self.upgrade_actions:
735 # in optimisations, we re-process the revlogs again
741 # in optimisations, we re-process the revlogs again
736 if a.type == OPTIMISATION:
742 if a.type == OPTIMISATION:
737 return True
743 return True
738 elif a.touches_filelogs:
744 elif a.touches_filelogs:
739 return True
745 return True
740 for a in self.removed_actions:
746 for a in self.removed_actions:
741 if a.touches_filelogs:
747 if a.touches_filelogs:
742 return True
748 return True
743 return False
749 return False
744
750
745 @property
751 @property
746 def touches_manifests(self):
752 def touches_manifests(self):
747 for a in self.upgrade_actions:
753 for a in self.upgrade_actions:
748 # in optimisations, we re-process the revlogs again
754 # in optimisations, we re-process the revlogs again
749 if a.type == OPTIMISATION:
755 if a.type == OPTIMISATION:
750 return True
756 return True
751 elif a.touches_manifests:
757 elif a.touches_manifests:
752 return True
758 return True
753 for a in self.removed_actions:
759 for a in self.removed_actions:
754 if a.touches_manifests:
760 if a.touches_manifests:
755 return True
761 return True
756 return False
762 return False
757
763
758 @property
764 @property
759 def touches_changelog(self):
765 def touches_changelog(self):
760 for a in self.upgrade_actions:
766 for a in self.upgrade_actions:
761 # in optimisations, we re-process the revlogs again
767 # in optimisations, we re-process the revlogs again
762 if a.type == OPTIMISATION:
768 if a.type == OPTIMISATION:
763 return True
769 return True
764 elif a.touches_changelog:
770 elif a.touches_changelog:
765 return True
771 return True
766 for a in self.removed_actions:
772 for a in self.removed_actions:
767 if a.touches_changelog:
773 if a.touches_changelog:
768 return True
774 return True
769 return False
775 return False
770
776
771 @property
777 @property
772 def touches_requirements(self):
778 def touches_requirements(self):
773 for a in self.upgrade_actions:
779 for a in self.upgrade_actions:
774 # optimisations are used to re-process revlogs and does not result
780 # optimisations are used to re-process revlogs and does not result
775 # in a requirement being added or removed
781 # in a requirement being added or removed
776 if a.type == OPTIMISATION:
782 if a.type == OPTIMISATION:
777 pass
783 pass
778 elif a.touches_requirements:
784 elif a.touches_requirements:
779 return True
785 return True
780 for a in self.removed_actions:
786 for a in self.removed_actions:
781 if a.touches_requirements:
787 if a.touches_requirements:
782 return True
788 return True
783
789
784 @property
790 @property
785 def touches_dirstate(self):
791 def touches_dirstate(self):
786 for a in self.upgrade_actions:
792 for a in self.upgrade_actions:
787 # revlog optimisations do not affect the dirstate
793 # revlog optimisations do not affect the dirstate
788 if a.type == OPTIMISATION:
794 if a.type == OPTIMISATION:
789 pass
795 pass
790 elif a.touches_dirstate:
796 elif a.touches_dirstate:
791 return True
797 return True
792 for a in self.removed_actions:
798 for a in self.removed_actions:
793 if a.touches_dirstate:
799 if a.touches_dirstate:
794 return True
800 return True
795
801
796 return False
802 return False
797
803
798 def _write_labeled(self, l, label):
804 def _write_labeled(self, l, label):
799 """
805 """
800 Utility function to aid writing of a list under one label
806 Utility function to aid writing of a list under one label
801 """
807 """
802 first = True
808 first = True
803 for r in sorted(l):
809 for r in sorted(l):
804 if not first:
810 if not first:
805 self.ui.write(b', ')
811 self.ui.write(b', ')
806 self.ui.write(r, label=label)
812 self.ui.write(r, label=label)
807 first = False
813 first = False
808
814
809 def print_requirements(self):
815 def print_requirements(self):
810 self.ui.write(_(b'requirements\n'))
816 self.ui.write(_(b'requirements\n'))
811 self.ui.write(_(b' preserved: '))
817 self.ui.write(_(b' preserved: '))
812 self._write_labeled(
818 self._write_labeled(
813 self._preserved_requirements, "upgrade-repo.requirement.preserved"
819 self._preserved_requirements, "upgrade-repo.requirement.preserved"
814 )
820 )
815 self.ui.write((b'\n'))
821 self.ui.write((b'\n'))
816 if self._removed_requirements:
822 if self._removed_requirements:
817 self.ui.write(_(b' removed: '))
823 self.ui.write(_(b' removed: '))
818 self._write_labeled(
824 self._write_labeled(
819 self._removed_requirements, "upgrade-repo.requirement.removed"
825 self._removed_requirements, "upgrade-repo.requirement.removed"
820 )
826 )
821 self.ui.write((b'\n'))
827 self.ui.write((b'\n'))
822 if self._added_requirements:
828 if self._added_requirements:
823 self.ui.write(_(b' added: '))
829 self.ui.write(_(b' added: '))
824 self._write_labeled(
830 self._write_labeled(
825 self._added_requirements, "upgrade-repo.requirement.added"
831 self._added_requirements, "upgrade-repo.requirement.added"
826 )
832 )
827 self.ui.write((b'\n'))
833 self.ui.write((b'\n'))
828 self.ui.write(b'\n')
834 self.ui.write(b'\n')
829
835
830 def print_optimisations(self):
836 def print_optimisations(self):
831 optimisations = [
837 optimisations = [
832 a for a in self.upgrade_actions if a.type == OPTIMISATION
838 a for a in self.upgrade_actions if a.type == OPTIMISATION
833 ]
839 ]
834 optimisations.sort(key=lambda a: a.name)
840 optimisations.sort(key=lambda a: a.name)
835 if optimisations:
841 if optimisations:
836 self.ui.write(_(b'optimisations: '))
842 self.ui.write(_(b'optimisations: '))
837 self._write_labeled(
843 self._write_labeled(
838 [a.name for a in optimisations],
844 [a.name for a in optimisations],
839 "upgrade-repo.optimisation.performed",
845 "upgrade-repo.optimisation.performed",
840 )
846 )
841 self.ui.write(b'\n\n')
847 self.ui.write(b'\n\n')
842
848
843 def print_upgrade_actions(self):
849 def print_upgrade_actions(self):
844 for a in self.upgrade_actions:
850 for a in self.upgrade_actions:
845 self.ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage))
851 self.ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage))
846
852
847 def print_affected_revlogs(self):
853 def print_affected_revlogs(self):
848 if not self.revlogs_to_process:
854 if not self.revlogs_to_process:
849 self.ui.write((b'no revlogs to process\n'))
855 self.ui.write((b'no revlogs to process\n'))
850 else:
856 else:
851 self.ui.write((b'processed revlogs:\n'))
857 self.ui.write((b'processed revlogs:\n'))
852 for r in sorted(self.revlogs_to_process):
858 for r in sorted(self.revlogs_to_process):
853 self.ui.write((b' - %s\n' % r))
859 self.ui.write((b' - %s\n' % r))
854 self.ui.write((b'\n'))
860 self.ui.write((b'\n'))
855
861
856 def print_unused_optimizations(self):
862 def print_unused_optimizations(self):
857 for i in self.unused_optimizations:
863 for i in self.unused_optimizations:
858 self.ui.status(_(b'%s\n %s\n\n') % (i.name, i.description))
864 self.ui.status(_(b'%s\n %s\n\n') % (i.name, i.description))
859
865
860 def has_upgrade_action(self, name):
866 def has_upgrade_action(self, name):
861 """Check whether the upgrade operation will perform this action"""
867 """Check whether the upgrade operation will perform this action"""
862 return name in self._upgrade_actions_names
868 return name in self._upgrade_actions_names
863
869
864 def print_post_op_messages(self):
870 def print_post_op_messages(self):
865 """print post upgrade operation warning messages"""
871 """print post upgrade operation warning messages"""
866 for a in self.upgrade_actions:
872 for a in self.upgrade_actions:
867 if a.postupgrademessage is not None:
873 if a.postupgrademessage is not None:
868 self.ui.warn(b'%s\n' % a.postupgrademessage)
874 self.ui.warn(b'%s\n' % a.postupgrademessage)
869 for a in self.removed_actions:
875 for a in self.removed_actions:
870 if a.postdowngrademessage is not None:
876 if a.postdowngrademessage is not None:
871 self.ui.warn(b'%s\n' % a.postdowngrademessage)
877 self.ui.warn(b'%s\n' % a.postdowngrademessage)
872
878
873
879
874 ### Code checking if a repository can got through the upgrade process at all. #
880 ### Code checking if a repository can got through the upgrade process at all. #
875
881
876
882
877 def requiredsourcerequirements(repo):
883 def requiredsourcerequirements(repo):
878 """Obtain requirements required to be present to upgrade a repo.
884 """Obtain requirements required to be present to upgrade a repo.
879
885
880 An upgrade will not be allowed if the repository doesn't have the
886 An upgrade will not be allowed if the repository doesn't have the
881 requirements returned by this function.
887 requirements returned by this function.
882 """
888 """
883 return {
889 return {
884 # Introduced in Mercurial 0.9.2.
890 # Introduced in Mercurial 0.9.2.
885 requirements.STORE_REQUIREMENT,
891 requirements.STORE_REQUIREMENT,
886 }
892 }
887
893
888
894
889 def blocksourcerequirements(repo):
895 def blocksourcerequirements(repo):
890 """Obtain requirements that will prevent an upgrade from occurring.
896 """Obtain requirements that will prevent an upgrade from occurring.
891
897
892 An upgrade cannot be performed if the source repository contains a
898 An upgrade cannot be performed if the source repository contains a
893 requirements in the returned set.
899 requirements in the returned set.
894 """
900 """
895 return {
901 return {
896 # The upgrade code does not yet support these experimental features.
902 # The upgrade code does not yet support these experimental features.
897 # This is an artificial limitation.
903 # This is an artificial limitation.
898 requirements.TREEMANIFEST_REQUIREMENT,
904 requirements.TREEMANIFEST_REQUIREMENT,
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
907 def check_revlog_version(reqs):
911 def check_revlog_version(reqs):
908 """Check that the requirements contain at least one Revlog version"""
912 """Check that the requirements contain at least one Revlog version"""
909 all_revlogs = {
913 all_revlogs = {
910 requirements.REVLOGV1_REQUIREMENT,
914 requirements.REVLOGV1_REQUIREMENT,
911 requirements.REVLOGV2_REQUIREMENT,
915 requirements.REVLOGV2_REQUIREMENT,
912 }
916 }
913 if not all_revlogs.intersection(reqs):
917 if not all_revlogs.intersection(reqs):
914 msg = _(b'cannot upgrade repository; missing a revlog version')
918 msg = _(b'cannot upgrade repository; missing a revlog version')
915 raise error.Abort(msg)
919 raise error.Abort(msg)
916
920
917
921
918 def check_source_requirements(repo):
922 def check_source_requirements(repo):
919 """Ensure that no existing requirements prevent the repository upgrade"""
923 """Ensure that no existing requirements prevent the repository upgrade"""
920
924
921 check_revlog_version(repo.requirements)
925 check_revlog_version(repo.requirements)
922 required = requiredsourcerequirements(repo)
926 required = requiredsourcerequirements(repo)
923 missingreqs = required - repo.requirements
927 missingreqs = required - repo.requirements
924 if missingreqs:
928 if missingreqs:
925 msg = _(b'cannot upgrade repository; requirement missing: %s')
929 msg = _(b'cannot upgrade repository; requirement missing: %s')
926 missingreqs = b', '.join(sorted(missingreqs))
930 missingreqs = b', '.join(sorted(missingreqs))
927 raise error.Abort(msg % missingreqs)
931 raise error.Abort(msg % missingreqs)
928
932
929 blocking = blocksourcerequirements(repo)
933 blocking = blocksourcerequirements(repo)
930 blockingreqs = blocking & repo.requirements
934 blockingreqs = blocking & repo.requirements
931 if blockingreqs:
935 if blockingreqs:
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 ####################
938
952
939
953
940 def supportremovedrequirements(repo):
954 def supportremovedrequirements(repo):
941 """Obtain requirements that can be removed during an upgrade.
955 """Obtain requirements that can be removed during an upgrade.
942
956
943 If an upgrade were to create a repository that dropped a requirement,
957 If an upgrade were to create a repository that dropped a requirement,
944 the dropped requirement must appear in the returned set for the upgrade
958 the dropped requirement must appear in the returned set for the upgrade
945 to be allowed.
959 to be allowed.
946 """
960 """
947 supported = {
961 supported = {
948 requirements.SPARSEREVLOG_REQUIREMENT,
962 requirements.SPARSEREVLOG_REQUIREMENT,
949 requirements.COPIESSDC_REQUIREMENT,
963 requirements.COPIESSDC_REQUIREMENT,
950 requirements.NODEMAP_REQUIREMENT,
964 requirements.NODEMAP_REQUIREMENT,
951 requirements.SHARESAFE_REQUIREMENT,
965 requirements.SHARESAFE_REQUIREMENT,
952 requirements.REVLOGV2_REQUIREMENT,
966 requirements.REVLOGV2_REQUIREMENT,
953 requirements.CHANGELOGV2_REQUIREMENT,
967 requirements.CHANGELOGV2_REQUIREMENT,
954 requirements.REVLOGV1_REQUIREMENT,
968 requirements.REVLOGV1_REQUIREMENT,
955 requirements.DIRSTATE_V2_REQUIREMENT,
969 requirements.DIRSTATE_V2_REQUIREMENT,
956 }
970 }
957 for name in compression.compengines:
971 for name in compression.compengines:
958 engine = compression.compengines[name]
972 engine = compression.compengines[name]
959 if engine.available() and engine.revlogheader():
973 if engine.available() and engine.revlogheader():
960 supported.add(b'exp-compression-%s' % name)
974 supported.add(b'exp-compression-%s' % name)
961 if engine.name() == b'zstd':
975 if engine.name() == b'zstd':
962 supported.add(b'revlog-compression-zstd')
976 supported.add(b'revlog-compression-zstd')
963 return supported
977 return supported
964
978
965
979
966 def supporteddestrequirements(repo):
980 def supporteddestrequirements(repo):
967 """Obtain requirements that upgrade supports in the destination.
981 """Obtain requirements that upgrade supports in the destination.
968
982
969 If the result of the upgrade would create requirements not in this set,
983 If the result of the upgrade would create requirements not in this set,
970 the upgrade is disallowed.
984 the upgrade is disallowed.
971
985
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]
990 if engine.available() and engine.revlogheader():
1005 if engine.available() and engine.revlogheader():
991 supported.add(b'exp-compression-%s' % name)
1006 supported.add(b'exp-compression-%s' % name)
992 if engine.name() == b'zstd':
1007 if engine.name() == b'zstd':
993 supported.add(b'revlog-compression-zstd')
1008 supported.add(b'revlog-compression-zstd')
994 return supported
1009 return supported
995
1010
996
1011
997 def allowednewrequirements(repo):
1012 def allowednewrequirements(repo):
998 """Obtain requirements that can be added to a repository during upgrade.
1013 """Obtain requirements that can be added to a repository during upgrade.
999
1014
1000 This is used to disallow proposed requirements from being added when
1015 This is used to disallow proposed requirements from being added when
1001 they weren't present before.
1016 they weren't present before.
1002
1017
1003 We use a list of allowed requirement additions instead of a list of known
1018 We use a list of allowed requirement additions instead of a list of known
1004 bad additions because the whitelist approach is safer and will prevent
1019 bad additions because the whitelist approach is safer and will prevent
1005 future, unknown requirements from accidentally being added.
1020 future, unknown requirements from accidentally being added.
1006 """
1021 """
1007 supported = {
1022 supported = {
1008 requirements.DOTENCODE_REQUIREMENT,
1023 requirements.DOTENCODE_REQUIREMENT,
1009 requirements.FNCACHE_REQUIREMENT,
1024 requirements.FNCACHE_REQUIREMENT,
1010 requirements.GENERALDELTA_REQUIREMENT,
1025 requirements.GENERALDELTA_REQUIREMENT,
1011 requirements.SPARSEREVLOG_REQUIREMENT,
1026 requirements.SPARSEREVLOG_REQUIREMENT,
1012 requirements.COPIESSDC_REQUIREMENT,
1027 requirements.COPIESSDC_REQUIREMENT,
1013 requirements.NODEMAP_REQUIREMENT,
1028 requirements.NODEMAP_REQUIREMENT,
1014 requirements.SHARESAFE_REQUIREMENT,
1029 requirements.SHARESAFE_REQUIREMENT,
1015 requirements.REVLOGV1_REQUIREMENT,
1030 requirements.REVLOGV1_REQUIREMENT,
1016 requirements.REVLOGV2_REQUIREMENT,
1031 requirements.REVLOGV2_REQUIREMENT,
1017 requirements.CHANGELOGV2_REQUIREMENT,
1032 requirements.CHANGELOGV2_REQUIREMENT,
1018 requirements.DIRSTATE_V2_REQUIREMENT,
1033 requirements.DIRSTATE_V2_REQUIREMENT,
1019 }
1034 }
1020 for name in compression.compengines:
1035 for name in compression.compengines:
1021 engine = compression.compengines[name]
1036 engine = compression.compengines[name]
1022 if engine.available() and engine.revlogheader():
1037 if engine.available() and engine.revlogheader():
1023 supported.add(b'exp-compression-%s' % name)
1038 supported.add(b'exp-compression-%s' % name)
1024 if engine.name() == b'zstd':
1039 if engine.name() == b'zstd':
1025 supported.add(b'revlog-compression-zstd')
1040 supported.add(b'revlog-compression-zstd')
1026 return supported
1041 return supported
1027
1042
1028
1043
1029 def check_requirements_changes(repo, new_reqs):
1044 def check_requirements_changes(repo, new_reqs):
1030 old_reqs = repo.requirements
1045 old_reqs = repo.requirements
1031 check_revlog_version(repo.requirements)
1046 check_revlog_version(repo.requirements)
1032 support_removal = supportremovedrequirements(repo)
1047 support_removal = supportremovedrequirements(repo)
1033 no_remove_reqs = old_reqs - new_reqs - support_removal
1048 no_remove_reqs = old_reqs - new_reqs - support_removal
1034 if no_remove_reqs:
1049 if no_remove_reqs:
1035 msg = _(b'cannot upgrade repository; requirement would be removed: %s')
1050 msg = _(b'cannot upgrade repository; requirement would be removed: %s')
1036 no_remove_reqs = b', '.join(sorted(no_remove_reqs))
1051 no_remove_reqs = b', '.join(sorted(no_remove_reqs))
1037 raise error.Abort(msg % no_remove_reqs)
1052 raise error.Abort(msg % no_remove_reqs)
1038
1053
1039 support_addition = allowednewrequirements(repo)
1054 support_addition = allowednewrequirements(repo)
1040 no_add_reqs = new_reqs - old_reqs - support_addition
1055 no_add_reqs = new_reqs - old_reqs - support_addition
1041 if no_add_reqs:
1056 if no_add_reqs:
1042 m = _(b'cannot upgrade repository; do not support adding requirement: ')
1057 m = _(b'cannot upgrade repository; do not support adding requirement: ')
1043 no_add_reqs = b', '.join(sorted(no_add_reqs))
1058 no_add_reqs = b', '.join(sorted(no_add_reqs))
1044 raise error.Abort(m + no_add_reqs)
1059 raise error.Abort(m + no_add_reqs)
1045
1060
1046 supported = supporteddestrequirements(repo)
1061 supported = supporteddestrequirements(repo)
1047 unsupported_reqs = new_reqs - supported
1062 unsupported_reqs = new_reqs - supported
1048 if unsupported_reqs:
1063 if unsupported_reqs:
1049 msg = _(
1064 msg = _(
1050 b'cannot upgrade repository; do not support destination '
1065 b'cannot upgrade repository; do not support destination '
1051 b'requirement: %s'
1066 b'requirement: %s'
1052 )
1067 )
1053 unsupported_reqs = b', '.join(sorted(unsupported_reqs))
1068 unsupported_reqs = b', '.join(sorted(unsupported_reqs))
1054 raise error.Abort(msg % unsupported_reqs)
1069 raise error.Abort(msg % unsupported_reqs)
@@ -1,604 +1,605 b''
1 setup
1 setup
2
2
3 $ cat >> $HGRCPATH <<EOF
3 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
4 > [extensions]
5 > share =
5 > share =
6 > [format]
6 > [format]
7 > use-share-safe = True
7 > use-share-safe = True
8 > [storage]
8 > [storage]
9 > revlog.persistent-nodemap.slow-path=allow
9 > revlog.persistent-nodemap.slow-path=allow
10 > # enforce zlib to ensure we can upgrade to zstd later
10 > # enforce zlib to ensure we can upgrade to zstd later
11 > [format]
11 > [format]
12 > revlog-compression=zlib
12 > revlog-compression=zlib
13 > # we want to be able to enable it later
13 > # we want to be able to enable it later
14 > use-persistent-nodemap=no
14 > use-persistent-nodemap=no
15 > EOF
15 > EOF
16
16
17 prepare source repo
17 prepare source repo
18
18
19 $ hg init source
19 $ hg init source
20 $ cd source
20 $ cd source
21 $ cat .hg/requires
21 $ cat .hg/requires
22 dirstate-v2 (dirstate-v2 !)
22 dirstate-v2 (dirstate-v2 !)
23 share-safe
23 share-safe
24 $ cat .hg/store/requires
24 $ cat .hg/store/requires
25 dotencode
25 dotencode
26 fncache
26 fncache
27 generaldelta
27 generaldelta
28 revlogv1
28 revlogv1
29 sparserevlog
29 sparserevlog
30 store
30 store
31 $ hg debugrequirements
31 $ hg debugrequirements
32 dotencode
32 dotencode
33 dirstate-v2 (dirstate-v2 !)
33 dirstate-v2 (dirstate-v2 !)
34 fncache
34 fncache
35 generaldelta
35 generaldelta
36 revlogv1
36 revlogv1
37 share-safe
37 share-safe
38 sparserevlog
38 sparserevlog
39 store
39 store
40
40
41 $ echo a > a
41 $ echo a > a
42 $ hg ci -Aqm "added a"
42 $ hg ci -Aqm "added a"
43 $ echo b > b
43 $ echo b > b
44 $ hg ci -Aqm "added b"
44 $ hg ci -Aqm "added b"
45
45
46 $ HGEDITOR=cat hg config --shared
46 $ HGEDITOR=cat hg config --shared
47 abort: repository is not shared; can't use --shared
47 abort: repository is not shared; can't use --shared
48 [10]
48 [10]
49 $ cd ..
49 $ cd ..
50
50
51 Create a shared repo and check the requirements are shared and read correctly
51 Create a shared repo and check the requirements are shared and read correctly
52 $ hg share source shared1
52 $ hg share source shared1
53 updating working directory
53 updating working directory
54 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 $ cd shared1
55 $ cd shared1
56 $ cat .hg/requires
56 $ cat .hg/requires
57 dirstate-v2 (dirstate-v2 !)
57 dirstate-v2 (dirstate-v2 !)
58 share-safe
58 share-safe
59 shared
59 shared
60
60
61 $ hg debugrequirements -R ../source
61 $ hg debugrequirements -R ../source
62 dotencode
62 dotencode
63 dirstate-v2 (dirstate-v2 !)
63 dirstate-v2 (dirstate-v2 !)
64 fncache
64 fncache
65 generaldelta
65 generaldelta
66 revlogv1
66 revlogv1
67 share-safe
67 share-safe
68 sparserevlog
68 sparserevlog
69 store
69 store
70
70
71 $ hg debugrequirements
71 $ hg debugrequirements
72 dotencode
72 dotencode
73 dirstate-v2 (dirstate-v2 !)
73 dirstate-v2 (dirstate-v2 !)
74 fncache
74 fncache
75 generaldelta
75 generaldelta
76 revlogv1
76 revlogv1
77 share-safe
77 share-safe
78 shared
78 shared
79 sparserevlog
79 sparserevlog
80 store
80 store
81
81
82 $ echo c > c
82 $ echo c > c
83 $ hg ci -Aqm "added c"
83 $ hg ci -Aqm "added c"
84
84
85 Check that config of the source repository is also loaded
85 Check that config of the source repository is also loaded
86
86
87 $ hg showconfig ui.curses
87 $ hg showconfig ui.curses
88 [1]
88 [1]
89
89
90 $ echo "[ui]" >> ../source/.hg/hgrc
90 $ echo "[ui]" >> ../source/.hg/hgrc
91 $ echo "curses=true" >> ../source/.hg/hgrc
91 $ echo "curses=true" >> ../source/.hg/hgrc
92
92
93 $ hg showconfig ui.curses
93 $ hg showconfig ui.curses
94 true
94 true
95
95
96 Test that extensions of source repository are also loaded
96 Test that extensions of source repository are also loaded
97
97
98 $ hg debugextensions
98 $ hg debugextensions
99 share
99 share
100 $ hg extdiff -p echo
100 $ hg extdiff -p echo
101 hg: unknown command 'extdiff'
101 hg: unknown command 'extdiff'
102 'extdiff' is provided by the following extension:
102 'extdiff' is provided by the following extension:
103
103
104 extdiff command to allow external programs to compare revisions
104 extdiff command to allow external programs to compare revisions
105
105
106 (use 'hg help extensions' for information on enabling extensions)
106 (use 'hg help extensions' for information on enabling extensions)
107 [10]
107 [10]
108
108
109 $ echo "[extensions]" >> ../source/.hg/hgrc
109 $ echo "[extensions]" >> ../source/.hg/hgrc
110 $ echo "extdiff=" >> ../source/.hg/hgrc
110 $ echo "extdiff=" >> ../source/.hg/hgrc
111
111
112 $ hg debugextensions -R ../source
112 $ hg debugextensions -R ../source
113 extdiff
113 extdiff
114 share
114 share
115 $ hg extdiff -R ../source -p echo
115 $ hg extdiff -R ../source -p echo
116
116
117 BROKEN: the command below will not work if config of shared source is not loaded
117 BROKEN: the command below will not work if config of shared source is not loaded
118 on dispatch but debugextensions says that extension
118 on dispatch but debugextensions says that extension
119 is loaded
119 is loaded
120 $ hg debugextensions
120 $ hg debugextensions
121 extdiff
121 extdiff
122 share
122 share
123
123
124 $ hg extdiff -p echo
124 $ hg extdiff -p echo
125
125
126 However, local .hg/hgrc should override the config set by share source
126 However, local .hg/hgrc should override the config set by share source
127
127
128 $ echo "[ui]" >> .hg/hgrc
128 $ echo "[ui]" >> .hg/hgrc
129 $ echo "curses=false" >> .hg/hgrc
129 $ echo "curses=false" >> .hg/hgrc
130
130
131 $ hg showconfig ui.curses
131 $ hg showconfig ui.curses
132 false
132 false
133
133
134 $ HGEDITOR=cat hg config --shared
134 $ HGEDITOR=cat hg config --shared
135 [ui]
135 [ui]
136 curses=true
136 curses=true
137 [extensions]
137 [extensions]
138 extdiff=
138 extdiff=
139
139
140 $ HGEDITOR=cat hg config --local
140 $ HGEDITOR=cat hg config --local
141 [ui]
141 [ui]
142 curses=false
142 curses=false
143
143
144 Testing that hooks set in source repository also runs in shared repo
144 Testing that hooks set in source repository also runs in shared repo
145
145
146 $ cd ../source
146 $ cd ../source
147 $ cat <<EOF >> .hg/hgrc
147 $ cat <<EOF >> .hg/hgrc
148 > [extensions]
148 > [extensions]
149 > hooklib=
149 > hooklib=
150 > [hooks]
150 > [hooks]
151 > pretxnchangegroup.reject_merge_commits = \
151 > pretxnchangegroup.reject_merge_commits = \
152 > python:hgext.hooklib.reject_merge_commits.hook
152 > python:hgext.hooklib.reject_merge_commits.hook
153 > EOF
153 > EOF
154
154
155 $ cd ..
155 $ cd ..
156 $ hg clone source cloned
156 $ hg clone source cloned
157 updating to branch default
157 updating to branch default
158 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
158 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
159 $ cd cloned
159 $ cd cloned
160 $ hg up 0
160 $ hg up 0
161 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
161 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
162 $ echo bar > bar
162 $ echo bar > bar
163 $ hg ci -Aqm "added bar"
163 $ hg ci -Aqm "added bar"
164 $ hg merge
164 $ hg merge
165 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
165 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 (branch merge, don't forget to commit)
166 (branch merge, don't forget to commit)
167 $ hg ci -m "merge commit"
167 $ hg ci -m "merge commit"
168
168
169 $ hg push ../source
169 $ hg push ../source
170 pushing to ../source
170 pushing to ../source
171 searching for changes
171 searching for changes
172 adding changesets
172 adding changesets
173 adding manifests
173 adding manifests
174 adding file changes
174 adding file changes
175 error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase.
175 error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase.
176 transaction abort!
176 transaction abort!
177 rollback completed
177 rollback completed
178 abort: bcde3522682d rejected as merge on the same branch. Please consider rebase.
178 abort: bcde3522682d rejected as merge on the same branch. Please consider rebase.
179 [255]
179 [255]
180
180
181 $ hg push ../shared1
181 $ hg push ../shared1
182 pushing to ../shared1
182 pushing to ../shared1
183 searching for changes
183 searching for changes
184 adding changesets
184 adding changesets
185 adding manifests
185 adding manifests
186 adding file changes
186 adding file changes
187 error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase.
187 error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase.
188 transaction abort!
188 transaction abort!
189 rollback completed
189 rollback completed
190 abort: bcde3522682d rejected as merge on the same branch. Please consider rebase.
190 abort: bcde3522682d rejected as merge on the same branch. Please consider rebase.
191 [255]
191 [255]
192
192
193 Test that if share source config is untrusted, we dont read it
193 Test that if share source config is untrusted, we dont read it
194
194
195 $ cd ../shared1
195 $ cd ../shared1
196
196
197 $ cat << EOF > $TESTTMP/untrusted.py
197 $ cat << EOF > $TESTTMP/untrusted.py
198 > from mercurial import scmutil, util
198 > from mercurial import scmutil, util
199 > def uisetup(ui):
199 > def uisetup(ui):
200 > class untrustedui(ui.__class__):
200 > class untrustedui(ui.__class__):
201 > def _trusted(self, fp, f):
201 > def _trusted(self, fp, f):
202 > if util.normpath(fp.name).endswith(b'source/.hg/hgrc'):
202 > if util.normpath(fp.name).endswith(b'source/.hg/hgrc'):
203 > return False
203 > return False
204 > return super(untrustedui, self)._trusted(fp, f)
204 > return super(untrustedui, self)._trusted(fp, f)
205 > ui.__class__ = untrustedui
205 > ui.__class__ = untrustedui
206 > EOF
206 > EOF
207
207
208 $ hg showconfig hooks
208 $ hg showconfig hooks
209 hooks.pretxnchangegroup.reject_merge_commits=python:hgext.hooklib.reject_merge_commits.hook
209 hooks.pretxnchangegroup.reject_merge_commits=python:hgext.hooklib.reject_merge_commits.hook
210
210
211 $ hg showconfig hooks --config extensions.untrusted=$TESTTMP/untrusted.py
211 $ hg showconfig hooks --config extensions.untrusted=$TESTTMP/untrusted.py
212 [1]
212 [1]
213
213
214 Update the source repository format and check that shared repo works
214 Update the source repository format and check that shared repo works
215
215
216 $ cd ../source
216 $ cd ../source
217
217
218 Disable zstd related tests because its not present on pure version
218 Disable zstd related tests because its not present on pure version
219 #if zstd
219 #if zstd
220 $ echo "[format]" >> .hg/hgrc
220 $ echo "[format]" >> .hg/hgrc
221 $ echo "revlog-compression=zstd" >> .hg/hgrc
221 $ echo "revlog-compression=zstd" >> .hg/hgrc
222
222
223 $ hg debugupgraderepo --run -q
223 $ hg debugupgraderepo --run -q
224 upgrade will perform the following actions:
224 upgrade will perform the following actions:
225
225
226 requirements
226 requirements
227 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-dirstate-v2 !)
227 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-dirstate-v2 !)
228 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (dirstate-v2 !)
228 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (dirstate-v2 !)
229 added: revlog-compression-zstd
229 added: revlog-compression-zstd
230
230
231 processed revlogs:
231 processed revlogs:
232 - all-filelogs
232 - all-filelogs
233 - changelog
233 - changelog
234 - manifest
234 - manifest
235
235
236 $ hg log -r .
236 $ hg log -r .
237 changeset: 1:5f6d8a4bf34a
237 changeset: 1:5f6d8a4bf34a
238 user: test
238 user: test
239 date: Thu Jan 01 00:00:00 1970 +0000
239 date: Thu Jan 01 00:00:00 1970 +0000
240 summary: added b
240 summary: added b
241
241
242 #endif
242 #endif
243 $ echo "[format]" >> .hg/hgrc
243 $ echo "[format]" >> .hg/hgrc
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
251 upgrade will perform the following actions:
252 upgrade will perform the following actions:
252
253
253 requirements
254 requirements
254 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-zstd no-dirstate-v2 !)
255 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-zstd no-dirstate-v2 !)
255 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, share-safe, sparserevlog, store (zstd no-dirstate-v2 !)
256 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, share-safe, sparserevlog, store (zstd no-dirstate-v2 !)
256 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-zstd dirstate-v2 !)
257 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-zstd dirstate-v2 !)
257 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlog-compression-zstd, revlogv1, share-safe, sparserevlog, store (zstd dirstate-v2 !)
258 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlog-compression-zstd, revlogv1, share-safe, sparserevlog, store (zstd dirstate-v2 !)
258 added: persistent-nodemap
259 added: persistent-nodemap
259
260
260 processed revlogs:
261 processed revlogs:
261 - all-filelogs
262 - all-filelogs
262 - changelog
263 - changelog
263 - manifest
264 - manifest
264
265
265 $ hg log -r .
266 $ hg log -r .
266 changeset: 1:5f6d8a4bf34a
267 changeset: 1:5f6d8a4bf34a
267 user: test
268 user: test
268 date: Thu Jan 01 00:00:00 1970 +0000
269 date: Thu Jan 01 00:00:00 1970 +0000
269 summary: added b
270 summary: added b
270
271
271
272
272 Shared one should work
273 Shared one should work
273 $ cd ../shared1
274 $ cd ../shared1
274 $ hg log -r .
275 $ hg log -r .
275 changeset: 2:155349b645be
276 changeset: 2:155349b645be
276 tag: tip
277 tag: tip
277 user: test
278 user: test
278 date: Thu Jan 01 00:00:00 1970 +0000
279 date: Thu Jan 01 00:00:00 1970 +0000
279 summary: added c
280 summary: added c
280
281
281
282
282 Testing that nonsharedrc is loaded for source and not shared
283 Testing that nonsharedrc is loaded for source and not shared
283
284
284 $ cd ../source
285 $ cd ../source
285 $ touch .hg/hgrc-not-shared
286 $ touch .hg/hgrc-not-shared
286 $ echo "[ui]" >> .hg/hgrc-not-shared
287 $ echo "[ui]" >> .hg/hgrc-not-shared
287 $ echo "traceback=true" >> .hg/hgrc-not-shared
288 $ echo "traceback=true" >> .hg/hgrc-not-shared
288
289
289 $ hg showconfig ui.traceback
290 $ hg showconfig ui.traceback
290 true
291 true
291
292
292 $ HGEDITOR=cat hg config --non-shared
293 $ HGEDITOR=cat hg config --non-shared
293 [ui]
294 [ui]
294 traceback=true
295 traceback=true
295
296
296 $ cd ../shared1
297 $ cd ../shared1
297 $ hg showconfig ui.traceback
298 $ hg showconfig ui.traceback
298 [1]
299 [1]
299
300
300 Unsharing works
301 Unsharing works
301
302
302 $ hg unshare
303 $ hg unshare
303
304
304 Test that source config is added to the shared one after unshare, and the config
305 Test that source config is added to the shared one after unshare, and the config
305 of current repo is still respected over the config which came from source config
306 of current repo is still respected over the config which came from source config
306 $ cd ../cloned
307 $ cd ../cloned
307 $ hg push ../shared1
308 $ hg push ../shared1
308 pushing to ../shared1
309 pushing to ../shared1
309 searching for changes
310 searching for changes
310 adding changesets
311 adding changesets
311 adding manifests
312 adding manifests
312 adding file changes
313 adding file changes
313 error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase.
314 error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase.
314 transaction abort!
315 transaction abort!
315 rollback completed
316 rollback completed
316 abort: bcde3522682d rejected as merge on the same branch. Please consider rebase.
317 abort: bcde3522682d rejected as merge on the same branch. Please consider rebase.
317 [255]
318 [255]
318 $ hg showconfig ui.curses -R ../shared1
319 $ hg showconfig ui.curses -R ../shared1
319 false
320 false
320
321
321 $ cd ../
322 $ cd ../
322
323
323 Test that upgrading using debugupgraderepo works
324 Test that upgrading using debugupgraderepo works
324 =================================================
325 =================================================
325
326
326 $ hg init non-share-safe --config format.use-share-safe=false
327 $ hg init non-share-safe --config format.use-share-safe=false
327 $ cd non-share-safe
328 $ cd non-share-safe
328 $ hg debugrequirements
329 $ hg debugrequirements
329 dotencode
330 dotencode
330 dirstate-v2 (dirstate-v2 !)
331 dirstate-v2 (dirstate-v2 !)
331 fncache
332 fncache
332 generaldelta
333 generaldelta
333 revlogv1
334 revlogv1
334 sparserevlog
335 sparserevlog
335 store
336 store
336 $ echo foo > foo
337 $ echo foo > foo
337 $ hg ci -Aqm 'added foo'
338 $ hg ci -Aqm 'added foo'
338 $ echo bar > bar
339 $ echo bar > bar
339 $ hg ci -Aqm 'added bar'
340 $ hg ci -Aqm 'added bar'
340
341
341 Create a share before upgrading
342 Create a share before upgrading
342
343
343 $ cd ..
344 $ cd ..
344 $ hg share non-share-safe nss-share
345 $ hg share non-share-safe nss-share
345 updating working directory
346 updating working directory
346 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
347 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
347 $ hg debugrequirements -R nss-share
348 $ hg debugrequirements -R nss-share
348 dotencode
349 dotencode
349 dirstate-v2 (dirstate-v2 !)
350 dirstate-v2 (dirstate-v2 !)
350 fncache
351 fncache
351 generaldelta
352 generaldelta
352 revlogv1
353 revlogv1
353 shared
354 shared
354 sparserevlog
355 sparserevlog
355 store
356 store
356 $ cd non-share-safe
357 $ cd non-share-safe
357
358
358 Upgrade
359 Upgrade
359
360
360 $ hg debugupgraderepo -q
361 $ hg debugupgraderepo -q
361 requirements
362 requirements
362 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-dirstate-v2 !)
363 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-dirstate-v2 !)
363 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
364 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
364 added: share-safe
365 added: share-safe
365
366
366 no revlogs to process
367 no revlogs to process
367
368
368 $ hg debugupgraderepo --run
369 $ hg debugupgraderepo --run
369 upgrade will perform the following actions:
370 upgrade will perform the following actions:
370
371
371 requirements
372 requirements
372 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-dirstate-v2 !)
373 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-dirstate-v2 !)
373 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
374 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
374 added: share-safe
375 added: share-safe
375
376
376 share-safe
377 share-safe
377 Upgrades a repository to share-safe format so that future shares of this repository share its requirements and configs.
378 Upgrades a repository to share-safe format so that future shares of this repository share its requirements and configs.
378
379
379 no revlogs to process
380 no revlogs to process
380
381
381 beginning upgrade...
382 beginning upgrade...
382 repository locked and read-only
383 repository locked and read-only
383 creating temporary repository to stage upgraded data: $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
384 creating temporary repository to stage upgraded data: $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
384 (it is safe to interrupt this process any time before data migration completes)
385 (it is safe to interrupt this process any time before data migration completes)
385 upgrading repository requirements
386 upgrading repository requirements
386 removing temporary repository $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
387 removing temporary repository $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
387 repository upgraded to share safe mode, existing shares will still work in old non-safe mode. Re-share existing shares to use them in safe mode New shares will be created in safe mode.
388 repository upgraded to share safe mode, existing shares will still work in old non-safe mode. Re-share existing shares to use them in safe mode New shares will be created in safe mode.
388
389
389 $ hg debugrequirements
390 $ hg debugrequirements
390 dotencode
391 dotencode
391 dirstate-v2 (dirstate-v2 !)
392 dirstate-v2 (dirstate-v2 !)
392 fncache
393 fncache
393 generaldelta
394 generaldelta
394 revlogv1
395 revlogv1
395 share-safe
396 share-safe
396 sparserevlog
397 sparserevlog
397 store
398 store
398
399
399 $ cat .hg/requires
400 $ cat .hg/requires
400 dirstate-v2 (dirstate-v2 !)
401 dirstate-v2 (dirstate-v2 !)
401 share-safe
402 share-safe
402
403
403 $ cat .hg/store/requires
404 $ cat .hg/store/requires
404 dotencode
405 dotencode
405 fncache
406 fncache
406 generaldelta
407 generaldelta
407 revlogv1
408 revlogv1
408 sparserevlog
409 sparserevlog
409 store
410 store
410
411
411 $ hg log -GT "{node}: {desc}\n"
412 $ hg log -GT "{node}: {desc}\n"
412 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
413 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
413 |
414 |
414 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
415 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
415
416
416
417
417 Make sure existing shares dont work with default config
418 Make sure existing shares dont work with default config
418
419
419 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
420 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
420 abort: version mismatch: source uses share-safe functionality while the current share does not
421 abort: version mismatch: source uses share-safe functionality while the current share does not
421 (see `hg help config.format.use-share-safe` for more information)
422 (see `hg help config.format.use-share-safe` for more information)
422 [255]
423 [255]
423
424
424
425
425 Create a safe share from upgrade one
426 Create a safe share from upgrade one
426
427
427 $ cd ..
428 $ cd ..
428 $ hg share non-share-safe ss-share
429 $ hg share non-share-safe ss-share
429 updating working directory
430 updating working directory
430 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
431 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
431 $ cd ss-share
432 $ cd ss-share
432 $ hg log -GT "{node}: {desc}\n"
433 $ hg log -GT "{node}: {desc}\n"
433 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
434 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
434 |
435 |
435 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
436 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
436
437
437 $ cd ../non-share-safe
438 $ cd ../non-share-safe
438
439
439 Test that downgrading works too
440 Test that downgrading works too
440
441
441 $ cat >> $HGRCPATH <<EOF
442 $ cat >> $HGRCPATH <<EOF
442 > [extensions]
443 > [extensions]
443 > share =
444 > share =
444 > [format]
445 > [format]
445 > use-share-safe = False
446 > use-share-safe = False
446 > EOF
447 > EOF
447
448
448 $ hg debugupgraderepo -q
449 $ hg debugupgraderepo -q
449 requirements
450 requirements
450 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-dirstate-v2 !)
451 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-dirstate-v2 !)
451 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
452 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
452 removed: share-safe
453 removed: share-safe
453
454
454 no revlogs to process
455 no revlogs to process
455
456
456 $ hg debugupgraderepo --run
457 $ hg debugupgraderepo --run
457 upgrade will perform the following actions:
458 upgrade will perform the following actions:
458
459
459 requirements
460 requirements
460 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-dirstate-v2 !)
461 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-dirstate-v2 !)
461 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
462 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
462 removed: share-safe
463 removed: share-safe
463
464
464 no revlogs to process
465 no revlogs to process
465
466
466 beginning upgrade...
467 beginning upgrade...
467 repository locked and read-only
468 repository locked and read-only
468 creating temporary repository to stage upgraded data: $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
469 creating temporary repository to stage upgraded data: $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
469 (it is safe to interrupt this process any time before data migration completes)
470 (it is safe to interrupt this process any time before data migration completes)
470 upgrading repository requirements
471 upgrading repository requirements
471 removing temporary repository $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
472 removing temporary repository $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
472 repository downgraded to not use share safe mode, existing shares will not work and needs to be reshared.
473 repository downgraded to not use share safe mode, existing shares will not work and needs to be reshared.
473
474
474 $ hg debugrequirements
475 $ hg debugrequirements
475 dotencode
476 dotencode
476 dirstate-v2 (dirstate-v2 !)
477 dirstate-v2 (dirstate-v2 !)
477 fncache
478 fncache
478 generaldelta
479 generaldelta
479 revlogv1
480 revlogv1
480 sparserevlog
481 sparserevlog
481 store
482 store
482
483
483 $ cat .hg/requires
484 $ cat .hg/requires
484 dotencode
485 dotencode
485 dirstate-v2 (dirstate-v2 !)
486 dirstate-v2 (dirstate-v2 !)
486 fncache
487 fncache
487 generaldelta
488 generaldelta
488 revlogv1
489 revlogv1
489 sparserevlog
490 sparserevlog
490 store
491 store
491
492
492 $ test -f .hg/store/requires
493 $ test -f .hg/store/requires
493 [1]
494 [1]
494
495
495 $ hg log -GT "{node}: {desc}\n"
496 $ hg log -GT "{node}: {desc}\n"
496 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
497 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
497 |
498 |
498 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
499 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
499
500
500
501
501 Make sure existing shares still works
502 Make sure existing shares still works
502
503
503 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
504 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
504 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
505 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
505 |
506 |
506 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
507 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
507
508
508
509
509 $ hg log -GT "{node}: {desc}\n" -R ../ss-share
510 $ hg log -GT "{node}: {desc}\n" -R ../ss-share
510 abort: share source does not support share-safe requirement
511 abort: share source does not support share-safe requirement
511 (see `hg help config.format.use-share-safe` for more information)
512 (see `hg help config.format.use-share-safe` for more information)
512 [255]
513 [255]
513
514
514 Testing automatic downgrade of shares when config is set
515 Testing automatic downgrade of shares when config is set
515
516
516 $ touch ../ss-share/.hg/wlock
517 $ touch ../ss-share/.hg/wlock
517 $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort
518 $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort
518 abort: failed to downgrade share, got error: Lock held
519 abort: failed to downgrade share, got error: Lock held
519 (see `hg help config.format.use-share-safe` for more information)
520 (see `hg help config.format.use-share-safe` for more information)
520 [255]
521 [255]
521 $ rm ../ss-share/.hg/wlock
522 $ rm ../ss-share/.hg/wlock
522
523
523 $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort
524 $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort
524 repository downgraded to not use share-safe mode
525 repository downgraded to not use share-safe mode
525 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
526 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
526 |
527 |
527 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
528 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
528
529
529
530
530 $ hg log -GT "{node}: {desc}\n" -R ../ss-share
531 $ hg log -GT "{node}: {desc}\n" -R ../ss-share
531 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
532 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
532 |
533 |
533 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
534 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
534
535
535
536
536
537
537 Testing automatic upgrade of shares when config is set
538 Testing automatic upgrade of shares when config is set
538
539
539 $ hg debugupgraderepo -q --run --config format.use-share-safe=True
540 $ hg debugupgraderepo -q --run --config format.use-share-safe=True
540 upgrade will perform the following actions:
541 upgrade will perform the following actions:
541
542
542 requirements
543 requirements
543 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-dirstate-v2 !)
544 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store (no-dirstate-v2 !)
544 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
545 preserved: dotencode, use-dirstate-v2, fncache, generaldelta, revlogv1, sparserevlog, store (dirstate-v2 !)
545 added: share-safe
546 added: share-safe
546
547
547 no revlogs to process
548 no revlogs to process
548
549
549 repository upgraded to share safe mode, existing shares will still work in old non-safe mode. Re-share existing shares to use them in safe mode New shares will be created in safe mode.
550 repository upgraded to share safe mode, existing shares will still work in old non-safe mode. Re-share existing shares to use them in safe mode New shares will be created in safe mode.
550 $ hg debugrequirements
551 $ hg debugrequirements
551 dotencode
552 dotencode
552 dirstate-v2 (dirstate-v2 !)
553 dirstate-v2 (dirstate-v2 !)
553 fncache
554 fncache
554 generaldelta
555 generaldelta
555 revlogv1
556 revlogv1
556 share-safe
557 share-safe
557 sparserevlog
558 sparserevlog
558 store
559 store
559 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
560 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
560 abort: version mismatch: source uses share-safe functionality while the current share does not
561 abort: version mismatch: source uses share-safe functionality while the current share does not
561 (see `hg help config.format.use-share-safe` for more information)
562 (see `hg help config.format.use-share-safe` for more information)
562 [255]
563 [255]
563
564
564 Check that if lock is taken, upgrade fails but read operation are successful
565 Check that if lock is taken, upgrade fails but read operation are successful
565 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgra
566 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgra
566 abort: share-safe mismatch with source.
567 abort: share-safe mismatch with source.
567 Unrecognized value 'upgra' of `share.safe-mismatch.source-safe` set.
568 Unrecognized value 'upgra' of `share.safe-mismatch.source-safe` set.
568 (see `hg help config.format.use-share-safe` for more information)
569 (see `hg help config.format.use-share-safe` for more information)
569 [255]
570 [255]
570 $ touch ../nss-share/.hg/wlock
571 $ touch ../nss-share/.hg/wlock
571 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow
572 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow
572 failed to upgrade share, got error: Lock held
573 failed to upgrade share, got error: Lock held
573 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
574 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
574 |
575 |
575 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
576 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
576
577
577
578
578 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow --config share.safe-mismatch.source-safe.warn=False
579 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow --config share.safe-mismatch.source-safe.warn=False
579 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
580 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
580 |
581 |
581 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
582 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
582
583
583
584
584 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort
585 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort
585 abort: failed to upgrade share, got error: Lock held
586 abort: failed to upgrade share, got error: Lock held
586 (see `hg help config.format.use-share-safe` for more information)
587 (see `hg help config.format.use-share-safe` for more information)
587 [255]
588 [255]
588
589
589 $ rm ../nss-share/.hg/wlock
590 $ rm ../nss-share/.hg/wlock
590 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort
591 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort
591 repository upgraded to use share-safe mode
592 repository upgraded to use share-safe mode
592 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
593 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
593 |
594 |
594 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
595 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
595
596
596
597
597 Test that unshare works
598 Test that unshare works
598
599
599 $ hg unshare -R ../nss-share
600 $ hg unshare -R ../nss-share
600 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
601 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
601 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
602 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
602 |
603 |
603 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
604 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
604
605
@@ -1,1822 +1,1824 b''
1 #require no-reposimplestore
1 #require no-reposimplestore
2
2
3 $ cat >> $HGRCPATH << EOF
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
4 > [extensions]
5 > share =
5 > share =
6 > [format]
6 > [format]
7 > # stabilize test accross variant
7 > # stabilize test accross variant
8 > revlog-compression=zlib
8 > revlog-compression=zlib
9 > EOF
9 > EOF
10
10
11 store and revlogv1 are required in source
11 store and revlogv1 are required in source
12
12
13 $ hg --config format.usestore=false init no-store
13 $ hg --config format.usestore=false init no-store
14 $ hg -R no-store debugupgraderepo
14 $ hg -R no-store debugupgraderepo
15 abort: cannot upgrade repository; requirement missing: store
15 abort: cannot upgrade repository; requirement missing: store
16 [255]
16 [255]
17
17
18 $ hg init no-revlogv1
18 $ hg init no-revlogv1
19 $ cat > no-revlogv1/.hg/requires << EOF
19 $ cat > no-revlogv1/.hg/requires << EOF
20 > dotencode
20 > dotencode
21 > fncache
21 > fncache
22 > generaldelta
22 > generaldelta
23 > store
23 > store
24 > EOF
24 > EOF
25
25
26 $ hg -R no-revlogv1 debugupgraderepo
26 $ hg -R no-revlogv1 debugupgraderepo
27 abort: cannot upgrade repository; missing a revlog version
27 abort: cannot upgrade repository; missing a revlog version
28 [255]
28 [255]
29
29
30 Cannot upgrade shared repositories
30 Cannot upgrade shared repositories
31
31
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
42 $ hg -R treemanifest debugupgraderepo
44 $ hg -R treemanifest debugupgraderepo
43 abort: cannot upgrade repository; unsupported source requirement: treemanifest
45 abort: cannot upgrade repository; unsupported source requirement: treemanifest
44 [255]
46 [255]
45
47
46 Cannot add treemanifest requirement during upgrade
48 Cannot add treemanifest requirement during upgrade
47
49
48 $ hg init disallowaddedreq
50 $ hg init disallowaddedreq
49 $ hg -R disallowaddedreq --config experimental.treemanifest=true debugupgraderepo
51 $ hg -R disallowaddedreq --config experimental.treemanifest=true debugupgraderepo
50 abort: cannot upgrade repository; do not support adding requirement: treemanifest
52 abort: cannot upgrade repository; do not support adding requirement: treemanifest
51 [255]
53 [255]
52
54
53 An upgrade of a repository created with recommended settings only suggests optimizations
55 An upgrade of a repository created with recommended settings only suggests optimizations
54
56
55 $ hg init empty
57 $ hg init empty
56 $ cd empty
58 $ cd empty
57 $ hg debugformat
59 $ hg debugformat
58 format-variant repo
60 format-variant repo
59 fncache: yes
61 fncache: yes
60 dirstate-v2: no
62 dirstate-v2: no
61 dotencode: yes
63 dotencode: yes
62 generaldelta: yes
64 generaldelta: yes
63 share-safe: yes
65 share-safe: yes
64 sparserevlog: yes
66 sparserevlog: yes
65 persistent-nodemap: no (no-rust !)
67 persistent-nodemap: no (no-rust !)
66 persistent-nodemap: yes (rust !)
68 persistent-nodemap: yes (rust !)
67 copies-sdc: no
69 copies-sdc: no
68 revlog-v2: no
70 revlog-v2: no
69 changelog-v2: no
71 changelog-v2: no
70 plain-cl-delta: yes
72 plain-cl-delta: yes
71 compression: zlib
73 compression: zlib
72 compression-level: default
74 compression-level: default
73 $ hg debugformat --verbose
75 $ hg debugformat --verbose
74 format-variant repo config default
76 format-variant repo config default
75 fncache: yes yes yes
77 fncache: yes yes yes
76 dirstate-v2: no no no
78 dirstate-v2: no no no
77 dotencode: yes yes yes
79 dotencode: yes yes yes
78 generaldelta: yes yes yes
80 generaldelta: yes yes yes
79 share-safe: yes yes yes
81 share-safe: yes yes yes
80 sparserevlog: yes yes yes
82 sparserevlog: yes yes yes
81 persistent-nodemap: no no no (no-rust !)
83 persistent-nodemap: no no no (no-rust !)
82 persistent-nodemap: yes yes no (rust !)
84 persistent-nodemap: yes yes no (rust !)
83 copies-sdc: no no no
85 copies-sdc: no no no
84 revlog-v2: no no no
86 revlog-v2: no no no
85 changelog-v2: no no no
87 changelog-v2: no no no
86 plain-cl-delta: yes yes yes
88 plain-cl-delta: yes yes yes
87 compression: zlib zlib zlib (no-zstd !)
89 compression: zlib zlib zlib (no-zstd !)
88 compression: zlib zlib zstd (zstd !)
90 compression: zlib zlib zstd (zstd !)
89 compression-level: default default default
91 compression-level: default default default
90 $ hg debugformat --verbose --config format.usefncache=no
92 $ hg debugformat --verbose --config format.usefncache=no
91 format-variant repo config default
93 format-variant repo config default
92 fncache: yes no yes
94 fncache: yes no yes
93 dirstate-v2: no no no
95 dirstate-v2: no no no
94 dotencode: yes no yes
96 dotencode: yes no yes
95 generaldelta: yes yes yes
97 generaldelta: yes yes yes
96 share-safe: yes yes yes
98 share-safe: yes yes yes
97 sparserevlog: yes yes yes
99 sparserevlog: yes yes yes
98 persistent-nodemap: no no no (no-rust !)
100 persistent-nodemap: no no no (no-rust !)
99 persistent-nodemap: yes yes no (rust !)
101 persistent-nodemap: yes yes no (rust !)
100 copies-sdc: no no no
102 copies-sdc: no no no
101 revlog-v2: no no no
103 revlog-v2: no no no
102 changelog-v2: no no no
104 changelog-v2: no no no
103 plain-cl-delta: yes yes yes
105 plain-cl-delta: yes yes yes
104 compression: zlib zlib zlib (no-zstd !)
106 compression: zlib zlib zlib (no-zstd !)
105 compression: zlib zlib zstd (zstd !)
107 compression: zlib zlib zstd (zstd !)
106 compression-level: default default default
108 compression-level: default default default
107 $ hg debugformat --verbose --config format.usefncache=no --color=debug
109 $ hg debugformat --verbose --config format.usefncache=no --color=debug
108 format-variant repo config default
110 format-variant repo config default
109 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
111 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
110 [formatvariant.name.uptodate|dirstate-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
112 [formatvariant.name.uptodate|dirstate-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
111 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
113 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes]
112 [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
114 [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
113 [formatvariant.name.uptodate|share-safe: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
115 [formatvariant.name.uptodate|share-safe: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
114 [formatvariant.name.uptodate|sparserevlog: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
116 [formatvariant.name.uptodate|sparserevlog: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
115 [formatvariant.name.uptodate|persistent-nodemap:][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] (no-rust !)
117 [formatvariant.name.uptodate|persistent-nodemap:][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] (no-rust !)
116 [formatvariant.name.mismatchdefault|persistent-nodemap:][formatvariant.repo.mismatchdefault| yes][formatvariant.config.special| yes][formatvariant.default| no] (rust !)
118 [formatvariant.name.mismatchdefault|persistent-nodemap:][formatvariant.repo.mismatchdefault| yes][formatvariant.config.special| yes][formatvariant.default| no] (rust !)
117 [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
119 [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
118 [formatvariant.name.uptodate|revlog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
120 [formatvariant.name.uptodate|revlog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
119 [formatvariant.name.uptodate|changelog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
121 [formatvariant.name.uptodate|changelog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
120 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
122 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
121 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib] (no-zstd !)
123 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib] (no-zstd !)
122 [formatvariant.name.mismatchdefault|compression: ][formatvariant.repo.mismatchdefault| zlib][formatvariant.config.special| zlib][formatvariant.default| zstd] (zstd !)
124 [formatvariant.name.mismatchdefault|compression: ][formatvariant.repo.mismatchdefault| zlib][formatvariant.config.special| zlib][formatvariant.default| zstd] (zstd !)
123 [formatvariant.name.uptodate|compression-level: ][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
125 [formatvariant.name.uptodate|compression-level: ][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
124 $ hg debugformat -Tjson
126 $ hg debugformat -Tjson
125 [
127 [
126 {
128 {
127 "config": true,
129 "config": true,
128 "default": true,
130 "default": true,
129 "name": "fncache",
131 "name": "fncache",
130 "repo": true
132 "repo": true
131 },
133 },
132 {
134 {
133 "config": false,
135 "config": false,
134 "default": false,
136 "default": false,
135 "name": "dirstate-v2",
137 "name": "dirstate-v2",
136 "repo": false
138 "repo": false
137 },
139 },
138 {
140 {
139 "config": true,
141 "config": true,
140 "default": true,
142 "default": true,
141 "name": "dotencode",
143 "name": "dotencode",
142 "repo": true
144 "repo": true
143 },
145 },
144 {
146 {
145 "config": true,
147 "config": true,
146 "default": true,
148 "default": true,
147 "name": "generaldelta",
149 "name": "generaldelta",
148 "repo": true
150 "repo": true
149 },
151 },
150 {
152 {
151 "config": true,
153 "config": true,
152 "default": true,
154 "default": true,
153 "name": "share-safe",
155 "name": "share-safe",
154 "repo": true
156 "repo": true
155 },
157 },
156 {
158 {
157 "config": true,
159 "config": true,
158 "default": true,
160 "default": true,
159 "name": "sparserevlog",
161 "name": "sparserevlog",
160 "repo": true
162 "repo": true
161 },
163 },
162 {
164 {
163 "config": false, (no-rust !)
165 "config": false, (no-rust !)
164 "config": true, (rust !)
166 "config": true, (rust !)
165 "default": false,
167 "default": false,
166 "name": "persistent-nodemap",
168 "name": "persistent-nodemap",
167 "repo": false (no-rust !)
169 "repo": false (no-rust !)
168 "repo": true (rust !)
170 "repo": true (rust !)
169 },
171 },
170 {
172 {
171 "config": false,
173 "config": false,
172 "default": false,
174 "default": false,
173 "name": "copies-sdc",
175 "name": "copies-sdc",
174 "repo": false
176 "repo": false
175 },
177 },
176 {
178 {
177 "config": false,
179 "config": false,
178 "default": false,
180 "default": false,
179 "name": "revlog-v2",
181 "name": "revlog-v2",
180 "repo": false
182 "repo": false
181 },
183 },
182 {
184 {
183 "config": false,
185 "config": false,
184 "default": false,
186 "default": false,
185 "name": "changelog-v2",
187 "name": "changelog-v2",
186 "repo": false
188 "repo": false
187 },
189 },
188 {
190 {
189 "config": true,
191 "config": true,
190 "default": true,
192 "default": true,
191 "name": "plain-cl-delta",
193 "name": "plain-cl-delta",
192 "repo": true
194 "repo": true
193 },
195 },
194 {
196 {
195 "config": "zlib",
197 "config": "zlib",
196 "default": "zlib", (no-zstd !)
198 "default": "zlib", (no-zstd !)
197 "default": "zstd", (zstd !)
199 "default": "zstd", (zstd !)
198 "name": "compression",
200 "name": "compression",
199 "repo": "zlib"
201 "repo": "zlib"
200 },
202 },
201 {
203 {
202 "config": "default",
204 "config": "default",
203 "default": "default",
205 "default": "default",
204 "name": "compression-level",
206 "name": "compression-level",
205 "repo": "default"
207 "repo": "default"
206 }
208 }
207 ]
209 ]
208 $ hg debugupgraderepo
210 $ hg debugupgraderepo
209 (no format upgrades found in existing repository)
211 (no format upgrades found in existing repository)
210 performing an upgrade with "--run" will make the following changes:
212 performing an upgrade with "--run" will make the following changes:
211
213
212 requirements
214 requirements
213 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
215 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
214 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
216 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
215
217
216 no revlogs to process
218 no revlogs to process
217
219
218 additional optimizations are available by specifying "--optimize <name>":
220 additional optimizations are available by specifying "--optimize <name>":
219
221
220 re-delta-parent
222 re-delta-parent
221 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
223 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
222
224
223 re-delta-multibase
225 re-delta-multibase
224 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
226 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
225
227
226 re-delta-all
228 re-delta-all
227 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
229 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
228
230
229 re-delta-fulladd
231 re-delta-fulladd
230 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
232 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
231
233
232
234
233 $ hg debugupgraderepo --quiet
235 $ hg debugupgraderepo --quiet
234 requirements
236 requirements
235 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
237 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
236 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
238 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
237
239
238 no revlogs to process
240 no revlogs to process
239
241
240
242
241 --optimize can be used to add optimizations
243 --optimize can be used to add optimizations
242
244
243 $ hg debugupgrade --optimize 're-delta-parent'
245 $ hg debugupgrade --optimize 're-delta-parent'
244 (no format upgrades found in existing repository)
246 (no format upgrades found in existing repository)
245 performing an upgrade with "--run" will make the following changes:
247 performing an upgrade with "--run" will make the following changes:
246
248
247 requirements
249 requirements
248 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
250 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
249 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
251 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
250
252
251 optimisations: re-delta-parent
253 optimisations: re-delta-parent
252
254
253 re-delta-parent
255 re-delta-parent
254 deltas within internal storage will choose a new base revision if needed
256 deltas within internal storage will choose a new base revision if needed
255
257
256 processed revlogs:
258 processed revlogs:
257 - all-filelogs
259 - all-filelogs
258 - changelog
260 - changelog
259 - manifest
261 - manifest
260
262
261 additional optimizations are available by specifying "--optimize <name>":
263 additional optimizations are available by specifying "--optimize <name>":
262
264
263 re-delta-multibase
265 re-delta-multibase
264 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
266 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
265
267
266 re-delta-all
268 re-delta-all
267 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
269 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
268
270
269 re-delta-fulladd
271 re-delta-fulladd
270 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
272 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
271
273
272
274
273 modern form of the option
275 modern form of the option
274
276
275 $ hg debugupgrade --optimize re-delta-parent
277 $ hg debugupgrade --optimize re-delta-parent
276 (no format upgrades found in existing repository)
278 (no format upgrades found in existing repository)
277 performing an upgrade with "--run" will make the following changes:
279 performing an upgrade with "--run" will make the following changes:
278
280
279 requirements
281 requirements
280 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
282 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
281 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
283 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
282
284
283 optimisations: re-delta-parent
285 optimisations: re-delta-parent
284
286
285 re-delta-parent
287 re-delta-parent
286 deltas within internal storage will choose a new base revision if needed
288 deltas within internal storage will choose a new base revision if needed
287
289
288 processed revlogs:
290 processed revlogs:
289 - all-filelogs
291 - all-filelogs
290 - changelog
292 - changelog
291 - manifest
293 - manifest
292
294
293 additional optimizations are available by specifying "--optimize <name>":
295 additional optimizations are available by specifying "--optimize <name>":
294
296
295 re-delta-multibase
297 re-delta-multibase
296 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
298 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
297
299
298 re-delta-all
300 re-delta-all
299 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
301 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
300
302
301 re-delta-fulladd
303 re-delta-fulladd
302 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
304 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
303
305
304 $ hg debugupgrade --optimize re-delta-parent --quiet
306 $ hg debugupgrade --optimize re-delta-parent --quiet
305 requirements
307 requirements
306 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
308 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
307 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
309 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
308
310
309 optimisations: re-delta-parent
311 optimisations: re-delta-parent
310
312
311 processed revlogs:
313 processed revlogs:
312 - all-filelogs
314 - all-filelogs
313 - changelog
315 - changelog
314 - manifest
316 - manifest
315
317
316
318
317 unknown optimization:
319 unknown optimization:
318
320
319 $ hg debugupgrade --optimize foobar
321 $ hg debugupgrade --optimize foobar
320 abort: unknown optimization action requested: foobar
322 abort: unknown optimization action requested: foobar
321 (run without arguments to see valid optimizations)
323 (run without arguments to see valid optimizations)
322 [255]
324 [255]
323
325
324 Various sub-optimal detections work
326 Various sub-optimal detections work
325
327
326 $ cat > .hg/requires << EOF
328 $ cat > .hg/requires << EOF
327 > revlogv1
329 > revlogv1
328 > store
330 > store
329 > EOF
331 > EOF
330
332
331 $ hg debugformat
333 $ hg debugformat
332 format-variant repo
334 format-variant repo
333 fncache: no
335 fncache: no
334 dirstate-v2: no
336 dirstate-v2: no
335 dotencode: no
337 dotencode: no
336 generaldelta: no
338 generaldelta: no
337 share-safe: no
339 share-safe: no
338 sparserevlog: no
340 sparserevlog: no
339 persistent-nodemap: no
341 persistent-nodemap: no
340 copies-sdc: no
342 copies-sdc: no
341 revlog-v2: no
343 revlog-v2: no
342 changelog-v2: no
344 changelog-v2: no
343 plain-cl-delta: yes
345 plain-cl-delta: yes
344 compression: zlib
346 compression: zlib
345 compression-level: default
347 compression-level: default
346 $ hg debugformat --verbose
348 $ hg debugformat --verbose
347 format-variant repo config default
349 format-variant repo config default
348 fncache: no yes yes
350 fncache: no yes yes
349 dirstate-v2: no no no
351 dirstate-v2: no no no
350 dotencode: no yes yes
352 dotencode: no yes yes
351 generaldelta: no yes yes
353 generaldelta: no yes yes
352 share-safe: no yes yes
354 share-safe: no yes yes
353 sparserevlog: no yes yes
355 sparserevlog: no yes yes
354 persistent-nodemap: no no no (no-rust !)
356 persistent-nodemap: no no no (no-rust !)
355 persistent-nodemap: no yes no (rust !)
357 persistent-nodemap: no yes no (rust !)
356 copies-sdc: no no no
358 copies-sdc: no no no
357 revlog-v2: no no no
359 revlog-v2: no no no
358 changelog-v2: no no no
360 changelog-v2: no no no
359 plain-cl-delta: yes yes yes
361 plain-cl-delta: yes yes yes
360 compression: zlib zlib zlib (no-zstd !)
362 compression: zlib zlib zlib (no-zstd !)
361 compression: zlib zlib zstd (zstd !)
363 compression: zlib zlib zstd (zstd !)
362 compression-level: default default default
364 compression-level: default default default
363 $ hg debugformat --verbose --config format.usegeneraldelta=no
365 $ hg debugformat --verbose --config format.usegeneraldelta=no
364 format-variant repo config default
366 format-variant repo config default
365 fncache: no yes yes
367 fncache: no yes yes
366 dirstate-v2: no no no
368 dirstate-v2: no no no
367 dotencode: no yes yes
369 dotencode: no yes yes
368 generaldelta: no no yes
370 generaldelta: no no yes
369 share-safe: no yes yes
371 share-safe: no yes yes
370 sparserevlog: no no yes
372 sparserevlog: no no yes
371 persistent-nodemap: no no no (no-rust !)
373 persistent-nodemap: no no no (no-rust !)
372 persistent-nodemap: no yes no (rust !)
374 persistent-nodemap: no yes no (rust !)
373 copies-sdc: no no no
375 copies-sdc: no no no
374 revlog-v2: no no no
376 revlog-v2: no no no
375 changelog-v2: no no no
377 changelog-v2: no no no
376 plain-cl-delta: yes yes yes
378 plain-cl-delta: yes yes yes
377 compression: zlib zlib zlib (no-zstd !)
379 compression: zlib zlib zlib (no-zstd !)
378 compression: zlib zlib zstd (zstd !)
380 compression: zlib zlib zstd (zstd !)
379 compression-level: default default default
381 compression-level: default default default
380 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
382 $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug
381 format-variant repo config default
383 format-variant repo config default
382 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
384 [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
383 [formatvariant.name.uptodate|dirstate-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
385 [formatvariant.name.uptodate|dirstate-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
384 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
386 [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
385 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
387 [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
386 [formatvariant.name.mismatchconfig|share-safe: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
388 [formatvariant.name.mismatchconfig|share-safe: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes]
387 [formatvariant.name.mismatchdefault|sparserevlog: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
389 [formatvariant.name.mismatchdefault|sparserevlog: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes]
388 [formatvariant.name.uptodate|persistent-nodemap:][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] (no-rust !)
390 [formatvariant.name.uptodate|persistent-nodemap:][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] (no-rust !)
389 [formatvariant.name.mismatchconfig|persistent-nodemap:][formatvariant.repo.mismatchconfig| no][formatvariant.config.special| yes][formatvariant.default| no] (rust !)
391 [formatvariant.name.mismatchconfig|persistent-nodemap:][formatvariant.repo.mismatchconfig| no][formatvariant.config.special| yes][formatvariant.default| no] (rust !)
390 [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
392 [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
391 [formatvariant.name.uptodate|revlog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
393 [formatvariant.name.uptodate|revlog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
392 [formatvariant.name.uptodate|changelog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
394 [formatvariant.name.uptodate|changelog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no]
393 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
395 [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes]
394 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib] (no-zstd !)
396 [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib] (no-zstd !)
395 [formatvariant.name.mismatchdefault|compression: ][formatvariant.repo.mismatchdefault| zlib][formatvariant.config.special| zlib][formatvariant.default| zstd] (zstd !)
397 [formatvariant.name.mismatchdefault|compression: ][formatvariant.repo.mismatchdefault| zlib][formatvariant.config.special| zlib][formatvariant.default| zstd] (zstd !)
396 [formatvariant.name.uptodate|compression-level: ][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
398 [formatvariant.name.uptodate|compression-level: ][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default]
397 $ hg debugupgraderepo
399 $ hg debugupgraderepo
398 note: selecting all-filelogs for processing to change: dotencode
400 note: selecting all-filelogs for processing to change: dotencode
399 note: selecting all-manifestlogs for processing to change: dotencode
401 note: selecting all-manifestlogs for processing to change: dotencode
400 note: selecting changelog for processing to change: dotencode
402 note: selecting changelog for processing to change: dotencode
401
403
402 repository lacks features recommended by current config options:
404 repository lacks features recommended by current config options:
403
405
404 fncache
406 fncache
405 long and reserved filenames may not work correctly; repository performance is sub-optimal
407 long and reserved filenames may not work correctly; repository performance is sub-optimal
406
408
407 dotencode
409 dotencode
408 storage of filenames beginning with a period or space may not work correctly
410 storage of filenames beginning with a period or space may not work correctly
409
411
410 generaldelta
412 generaldelta
411 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
413 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
412
414
413 share-safe
415 share-safe
414 old shared repositories do not share source repository requirements and config. This leads to various problems when the source repository format is upgraded or some new extensions are enabled.
416 old shared repositories do not share source repository requirements and config. This leads to various problems when the source repository format is upgraded or some new extensions are enabled.
415
417
416 sparserevlog
418 sparserevlog
417 in order to limit disk reading and memory usage on older version, the span of a delta chain from its root to its end is limited, whatever the relevant data in this span. This can severly limit Mercurial ability to build good chain of delta resulting is much more storage space being taken and limit reusability of on disk delta during exchange.
419 in order to limit disk reading and memory usage on older version, the span of a delta chain from its root to its end is limited, whatever the relevant data in this span. This can severly limit Mercurial ability to build good chain of delta resulting is much more storage space being taken and limit reusability of on disk delta during exchange.
418
420
419 persistent-nodemap (rust !)
421 persistent-nodemap (rust !)
420 persist the node -> rev mapping on disk to speedup lookup (rust !)
422 persist the node -> rev mapping on disk to speedup lookup (rust !)
421 (rust !)
423 (rust !)
422
424
423 performing an upgrade with "--run" will make the following changes:
425 performing an upgrade with "--run" will make the following changes:
424
426
425 requirements
427 requirements
426 preserved: revlogv1, store
428 preserved: revlogv1, store
427 added: dotencode, fncache, generaldelta, share-safe, sparserevlog (no-rust !)
429 added: dotencode, fncache, generaldelta, share-safe, sparserevlog (no-rust !)
428 added: dotencode, fncache, generaldelta, persistent-nodemap, share-safe, sparserevlog (rust !)
430 added: dotencode, fncache, generaldelta, persistent-nodemap, share-safe, sparserevlog (rust !)
429
431
430 fncache
432 fncache
431 repository will be more resilient to storing certain paths and performance of certain operations should be improved
433 repository will be more resilient to storing certain paths and performance of certain operations should be improved
432
434
433 dotencode
435 dotencode
434 repository will be better able to store files beginning with a space or period
436 repository will be better able to store files beginning with a space or period
435
437
436 generaldelta
438 generaldelta
437 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
439 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
438
440
439 share-safe
441 share-safe
440 Upgrades a repository to share-safe format so that future shares of this repository share its requirements and configs.
442 Upgrades a repository to share-safe format so that future shares of this repository share its requirements and configs.
441
443
442 sparserevlog
444 sparserevlog
443 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
445 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
444
446
445 persistent-nodemap (rust !)
447 persistent-nodemap (rust !)
446 Speedup revision lookup by node id. (rust !)
448 Speedup revision lookup by node id. (rust !)
447 (rust !)
449 (rust !)
448 processed revlogs:
450 processed revlogs:
449 - all-filelogs
451 - all-filelogs
450 - changelog
452 - changelog
451 - manifest
453 - manifest
452
454
453 additional optimizations are available by specifying "--optimize <name>":
455 additional optimizations are available by specifying "--optimize <name>":
454
456
455 re-delta-parent
457 re-delta-parent
456 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
458 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
457
459
458 re-delta-multibase
460 re-delta-multibase
459 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
461 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
460
462
461 re-delta-all
463 re-delta-all
462 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
464 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
463
465
464 re-delta-fulladd
466 re-delta-fulladd
465 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
467 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
466
468
467 $ hg debugupgraderepo --quiet
469 $ hg debugupgraderepo --quiet
468 requirements
470 requirements
469 preserved: revlogv1, store
471 preserved: revlogv1, store
470 added: dotencode, fncache, generaldelta, share-safe, sparserevlog (no-rust !)
472 added: dotencode, fncache, generaldelta, share-safe, sparserevlog (no-rust !)
471 added: dotencode, fncache, generaldelta, persistent-nodemap, share-safe, sparserevlog (rust !)
473 added: dotencode, fncache, generaldelta, persistent-nodemap, share-safe, sparserevlog (rust !)
472
474
473 processed revlogs:
475 processed revlogs:
474 - all-filelogs
476 - all-filelogs
475 - changelog
477 - changelog
476 - manifest
478 - manifest
477
479
478
480
479 $ hg --config format.dotencode=false debugupgraderepo
481 $ hg --config format.dotencode=false debugupgraderepo
480 note: selecting all-filelogs for processing to change: fncache
482 note: selecting all-filelogs for processing to change: fncache
481 note: selecting all-manifestlogs for processing to change: fncache
483 note: selecting all-manifestlogs for processing to change: fncache
482 note: selecting changelog for processing to change: fncache
484 note: selecting changelog for processing to change: fncache
483
485
484 repository lacks features recommended by current config options:
486 repository lacks features recommended by current config options:
485
487
486 fncache
488 fncache
487 long and reserved filenames may not work correctly; repository performance is sub-optimal
489 long and reserved filenames may not work correctly; repository performance is sub-optimal
488
490
489 generaldelta
491 generaldelta
490 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
492 deltas within internal storage are unable to choose optimal revisions; repository is larger and slower than it could be; interaction with other repositories may require extra network and CPU resources, making "hg push" and "hg pull" slower
491
493
492 share-safe
494 share-safe
493 old shared repositories do not share source repository requirements and config. This leads to various problems when the source repository format is upgraded or some new extensions are enabled.
495 old shared repositories do not share source repository requirements and config. This leads to various problems when the source repository format is upgraded or some new extensions are enabled.
494
496
495 sparserevlog
497 sparserevlog
496 in order to limit disk reading and memory usage on older version, the span of a delta chain from its root to its end is limited, whatever the relevant data in this span. This can severly limit Mercurial ability to build good chain of delta resulting is much more storage space being taken and limit reusability of on disk delta during exchange.
498 in order to limit disk reading and memory usage on older version, the span of a delta chain from its root to its end is limited, whatever the relevant data in this span. This can severly limit Mercurial ability to build good chain of delta resulting is much more storage space being taken and limit reusability of on disk delta during exchange.
497
499
498 persistent-nodemap (rust !)
500 persistent-nodemap (rust !)
499 persist the node -> rev mapping on disk to speedup lookup (rust !)
501 persist the node -> rev mapping on disk to speedup lookup (rust !)
500 (rust !)
502 (rust !)
501 repository lacks features used by the default config options:
503 repository lacks features used by the default config options:
502
504
503 dotencode
505 dotencode
504 storage of filenames beginning with a period or space may not work correctly
506 storage of filenames beginning with a period or space may not work correctly
505
507
506
508
507 performing an upgrade with "--run" will make the following changes:
509 performing an upgrade with "--run" will make the following changes:
508
510
509 requirements
511 requirements
510 preserved: revlogv1, store
512 preserved: revlogv1, store
511 added: fncache, generaldelta, share-safe, sparserevlog (no-rust !)
513 added: fncache, generaldelta, share-safe, sparserevlog (no-rust !)
512 added: fncache, generaldelta, persistent-nodemap, share-safe, sparserevlog (rust !)
514 added: fncache, generaldelta, persistent-nodemap, share-safe, sparserevlog (rust !)
513
515
514 fncache
516 fncache
515 repository will be more resilient to storing certain paths and performance of certain operations should be improved
517 repository will be more resilient to storing certain paths and performance of certain operations should be improved
516
518
517 generaldelta
519 generaldelta
518 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
520 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
519
521
520 share-safe
522 share-safe
521 Upgrades a repository to share-safe format so that future shares of this repository share its requirements and configs.
523 Upgrades a repository to share-safe format so that future shares of this repository share its requirements and configs.
522
524
523 sparserevlog
525 sparserevlog
524 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
526 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
525
527
526 persistent-nodemap (rust !)
528 persistent-nodemap (rust !)
527 Speedup revision lookup by node id. (rust !)
529 Speedup revision lookup by node id. (rust !)
528 (rust !)
530 (rust !)
529 processed revlogs:
531 processed revlogs:
530 - all-filelogs
532 - all-filelogs
531 - changelog
533 - changelog
532 - manifest
534 - manifest
533
535
534 additional optimizations are available by specifying "--optimize <name>":
536 additional optimizations are available by specifying "--optimize <name>":
535
537
536 re-delta-parent
538 re-delta-parent
537 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
539 deltas within internal storage will be recalculated to choose an optimal base revision where this was not already done; the size of the repository may shrink and various operations may become faster; the first time this optimization is performed could slow down upgrade execution considerably; subsequent invocations should not run noticeably slower
538
540
539 re-delta-multibase
541 re-delta-multibase
540 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
542 deltas within internal storage will be recalculated against multiple base revision and the smallest difference will be used; the size of the repository may shrink significantly when there are many merges; this optimization will slow down execution in proportion to the number of merges in the repository and the amount of files in the repository; this slow down should not be significant unless there are tens of thousands of files and thousands of merges
541
543
542 re-delta-all
544 re-delta-all
543 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
545 deltas within internal storage will always be recalculated without reusing prior deltas; this will likely make execution run several times slower; this optimization is typically not needed
544
546
545 re-delta-fulladd
547 re-delta-fulladd
546 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
548 every revision will be re-added as if it was new content. It will go through the full storage mechanism giving extensions a chance to process it (eg. lfs). This is similar to "re-delta-all" but even slower since more logic is involved.
547
549
548
550
549 $ cd ..
551 $ cd ..
550
552
551 Upgrading a repository that is already modern essentially no-ops
553 Upgrading a repository that is already modern essentially no-ops
552
554
553 $ hg init modern
555 $ hg init modern
554 $ hg -R modern debugupgraderepo --run
556 $ hg -R modern debugupgraderepo --run
555 nothing to do
557 nothing to do
556
558
557 Upgrading a repository to generaldelta works
559 Upgrading a repository to generaldelta works
558
560
559 $ hg --config format.usegeneraldelta=false init upgradegd
561 $ hg --config format.usegeneraldelta=false init upgradegd
560 $ cd upgradegd
562 $ cd upgradegd
561 $ touch f0
563 $ touch f0
562 $ hg -q commit -A -m initial
564 $ hg -q commit -A -m initial
563 $ mkdir FooBarDirectory.d
565 $ mkdir FooBarDirectory.d
564 $ touch FooBarDirectory.d/f1
566 $ touch FooBarDirectory.d/f1
565 $ hg -q commit -A -m 'add f1'
567 $ hg -q commit -A -m 'add f1'
566 $ hg -q up -r 0
568 $ hg -q up -r 0
567 >>> from __future__ import absolute_import, print_function
569 >>> from __future__ import absolute_import, print_function
568 >>> import random
570 >>> import random
569 >>> random.seed(0) # have a reproducible content
571 >>> random.seed(0) # have a reproducible content
570 >>> with open("f2", "wb") as f:
572 >>> with open("f2", "wb") as f:
571 ... for i in range(100000):
573 ... for i in range(100000):
572 ... f.write(b"%d\n" % random.randint(1000000000, 9999999999)) and None
574 ... f.write(b"%d\n" % random.randint(1000000000, 9999999999)) and None
573 $ hg -q commit -A -m 'add f2'
575 $ hg -q commit -A -m 'add f2'
574
576
575 make sure we have a .d file
577 make sure we have a .d file
576
578
577 $ ls -d .hg/store/data/*
579 $ ls -d .hg/store/data/*
578 .hg/store/data/_foo_bar_directory.d.hg
580 .hg/store/data/_foo_bar_directory.d.hg
579 .hg/store/data/f0.i
581 .hg/store/data/f0.i
580 .hg/store/data/f2.d
582 .hg/store/data/f2.d
581 .hg/store/data/f2.i
583 .hg/store/data/f2.i
582
584
583 $ hg debugupgraderepo --run --config format.sparse-revlog=false
585 $ hg debugupgraderepo --run --config format.sparse-revlog=false
584 note: selecting all-filelogs for processing to change: generaldelta
586 note: selecting all-filelogs for processing to change: generaldelta
585 note: selecting all-manifestlogs for processing to change: generaldelta
587 note: selecting all-manifestlogs for processing to change: generaldelta
586 note: selecting changelog for processing to change: generaldelta
588 note: selecting changelog for processing to change: generaldelta
587
589
588 upgrade will perform the following actions:
590 upgrade will perform the following actions:
589
591
590 requirements
592 requirements
591 preserved: dotencode, fncache, revlogv1, share-safe, store (no-rust !)
593 preserved: dotencode, fncache, revlogv1, share-safe, store (no-rust !)
592 preserved: dotencode, fncache, persistent-nodemap, revlogv1, share-safe, store (rust !)
594 preserved: dotencode, fncache, persistent-nodemap, revlogv1, share-safe, store (rust !)
593 added: generaldelta
595 added: generaldelta
594
596
595 generaldelta
597 generaldelta
596 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
598 repository storage will be able to create optimal deltas; new repository data will be smaller and read times should decrease; interacting with other repositories using this storage model should require less network and CPU resources, making "hg push" and "hg pull" faster
597
599
598 processed revlogs:
600 processed revlogs:
599 - all-filelogs
601 - all-filelogs
600 - changelog
602 - changelog
601 - manifest
603 - manifest
602
604
603 beginning upgrade...
605 beginning upgrade...
604 repository locked and read-only
606 repository locked and read-only
605 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
607 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
606 (it is safe to interrupt this process any time before data migration completes)
608 (it is safe to interrupt this process any time before data migration completes)
607 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
609 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
608 migrating 519 KB in store; 1.05 MB tracked data
610 migrating 519 KB in store; 1.05 MB tracked data
609 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
611 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
610 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
612 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
611 migrating 1 manifests containing 3 revisions (384 bytes in store; 238 bytes tracked data)
613 migrating 1 manifests containing 3 revisions (384 bytes in store; 238 bytes tracked data)
612 finished migrating 3 manifest revisions across 1 manifests; change in size: -17 bytes
614 finished migrating 3 manifest revisions across 1 manifests; change in size: -17 bytes
613 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
615 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
614 finished migrating 3 changelog revisions; change in size: 0 bytes
616 finished migrating 3 changelog revisions; change in size: 0 bytes
615 finished migrating 9 total revisions; total change in store size: -17 bytes
617 finished migrating 9 total revisions; total change in store size: -17 bytes
616 copying phaseroots
618 copying phaseroots
617 copying requires
619 copying requires
618 data fully upgraded in a temporary repository
620 data fully upgraded in a temporary repository
619 marking source repository as being upgraded; clients will be unable to read from repository
621 marking source repository as being upgraded; clients will be unable to read from repository
620 starting in-place swap of repository data
622 starting in-place swap of repository data
621 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
623 replaced files will be backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
622 replacing store...
624 replacing store...
623 store replacement complete; repository was inconsistent for *s (glob)
625 store replacement complete; repository was inconsistent for *s (glob)
624 finalizing requirements file and making repository readable again
626 finalizing requirements file and making repository readable again
625 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
627 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
626 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
628 copy of old repository backed up at $TESTTMP/upgradegd/.hg/upgradebackup.* (glob)
627 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
629 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
628
630
629 Original requirements backed up
631 Original requirements backed up
630
632
631 $ cat .hg/upgradebackup.*/requires
633 $ cat .hg/upgradebackup.*/requires
632 share-safe
634 share-safe
633 $ cat .hg/upgradebackup.*/store/requires
635 $ cat .hg/upgradebackup.*/store/requires
634 dotencode
636 dotencode
635 fncache
637 fncache
636 persistent-nodemap (rust !)
638 persistent-nodemap (rust !)
637 revlogv1
639 revlogv1
638 store
640 store
639 upgradeinprogress
641 upgradeinprogress
640
642
641 generaldelta added to original requirements files
643 generaldelta added to original requirements files
642
644
643 $ hg debugrequires
645 $ hg debugrequires
644 dotencode
646 dotencode
645 fncache
647 fncache
646 generaldelta
648 generaldelta
647 persistent-nodemap (rust !)
649 persistent-nodemap (rust !)
648 revlogv1
650 revlogv1
649 share-safe
651 share-safe
650 store
652 store
651
653
652 store directory has files we expect
654 store directory has files we expect
653
655
654 $ ls .hg/store
656 $ ls .hg/store
655 00changelog.i
657 00changelog.i
656 00manifest.i
658 00manifest.i
657 data
659 data
658 fncache
660 fncache
659 phaseroots
661 phaseroots
660 requires
662 requires
661 undo
663 undo
662 undo.backupfiles
664 undo.backupfiles
663 undo.phaseroots
665 undo.phaseroots
664
666
665 manifest should be generaldelta
667 manifest should be generaldelta
666
668
667 $ hg debugrevlog -m | grep flags
669 $ hg debugrevlog -m | grep flags
668 flags : inline, generaldelta
670 flags : inline, generaldelta
669
671
670 verify should be happy
672 verify should be happy
671
673
672 $ hg verify
674 $ hg verify
673 checking changesets
675 checking changesets
674 checking manifests
676 checking manifests
675 crosschecking files in changesets and manifests
677 crosschecking files in changesets and manifests
676 checking files
678 checking files
677 checked 3 changesets with 3 changes to 3 files
679 checked 3 changesets with 3 changes to 3 files
678
680
679 old store should be backed up
681 old store should be backed up
680
682
681 $ ls -d .hg/upgradebackup.*/
683 $ ls -d .hg/upgradebackup.*/
682 .hg/upgradebackup.*/ (glob)
684 .hg/upgradebackup.*/ (glob)
683 $ ls .hg/upgradebackup.*/store
685 $ ls .hg/upgradebackup.*/store
684 00changelog.i
686 00changelog.i
685 00manifest.i
687 00manifest.i
686 data
688 data
687 fncache
689 fncache
688 phaseroots
690 phaseroots
689 requires
691 requires
690 undo
692 undo
691 undo.backup.fncache
693 undo.backup.fncache
692 undo.backupfiles
694 undo.backupfiles
693 undo.phaseroots
695 undo.phaseroots
694
696
695 unless --no-backup is passed
697 unless --no-backup is passed
696
698
697 $ rm -rf .hg/upgradebackup.*/
699 $ rm -rf .hg/upgradebackup.*/
698 $ hg debugupgraderepo --run --no-backup
700 $ hg debugupgraderepo --run --no-backup
699 note: selecting all-filelogs for processing to change: sparserevlog
701 note: selecting all-filelogs for processing to change: sparserevlog
700 note: selecting all-manifestlogs for processing to change: sparserevlog
702 note: selecting all-manifestlogs for processing to change: sparserevlog
701 note: selecting changelog for processing to change: sparserevlog
703 note: selecting changelog for processing to change: sparserevlog
702
704
703 upgrade will perform the following actions:
705 upgrade will perform the following actions:
704
706
705 requirements
707 requirements
706 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
708 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
707 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
709 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
708 added: sparserevlog
710 added: sparserevlog
709
711
710 sparserevlog
712 sparserevlog
711 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
713 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
712
714
713 processed revlogs:
715 processed revlogs:
714 - all-filelogs
716 - all-filelogs
715 - changelog
717 - changelog
716 - manifest
718 - manifest
717
719
718 beginning upgrade...
720 beginning upgrade...
719 repository locked and read-only
721 repository locked and read-only
720 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
722 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
721 (it is safe to interrupt this process any time before data migration completes)
723 (it is safe to interrupt this process any time before data migration completes)
722 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
724 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
723 migrating 519 KB in store; 1.05 MB tracked data
725 migrating 519 KB in store; 1.05 MB tracked data
724 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
726 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
725 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
727 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
726 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
728 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
727 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
729 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
728 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
730 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
729 finished migrating 3 changelog revisions; change in size: 0 bytes
731 finished migrating 3 changelog revisions; change in size: 0 bytes
730 finished migrating 9 total revisions; total change in store size: 0 bytes
732 finished migrating 9 total revisions; total change in store size: 0 bytes
731 copying phaseroots
733 copying phaseroots
732 copying requires
734 copying requires
733 data fully upgraded in a temporary repository
735 data fully upgraded in a temporary repository
734 marking source repository as being upgraded; clients will be unable to read from repository
736 marking source repository as being upgraded; clients will be unable to read from repository
735 starting in-place swap of repository data
737 starting in-place swap of repository data
736 replacing store...
738 replacing store...
737 store replacement complete; repository was inconsistent for * (glob)
739 store replacement complete; repository was inconsistent for * (glob)
738 finalizing requirements file and making repository readable again
740 finalizing requirements file and making repository readable again
739 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
741 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
740 $ ls -1 .hg/ | grep upgradebackup
742 $ ls -1 .hg/ | grep upgradebackup
741 [1]
743 [1]
742
744
743 We can restrict optimization to some revlog:
745 We can restrict optimization to some revlog:
744
746
745 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
747 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
746 upgrade will perform the following actions:
748 upgrade will perform the following actions:
747
749
748 requirements
750 requirements
749 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
751 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
750 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
752 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
751
753
752 optimisations: re-delta-parent
754 optimisations: re-delta-parent
753
755
754 re-delta-parent
756 re-delta-parent
755 deltas within internal storage will choose a new base revision if needed
757 deltas within internal storage will choose a new base revision if needed
756
758
757 processed revlogs:
759 processed revlogs:
758 - manifest
760 - manifest
759
761
760 beginning upgrade...
762 beginning upgrade...
761 repository locked and read-only
763 repository locked and read-only
762 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
764 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
763 (it is safe to interrupt this process any time before data migration completes)
765 (it is safe to interrupt this process any time before data migration completes)
764 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
766 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
765 migrating 519 KB in store; 1.05 MB tracked data
767 migrating 519 KB in store; 1.05 MB tracked data
766 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
768 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
767 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
769 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
768 blindly copying data/f0.i containing 1 revisions
770 blindly copying data/f0.i containing 1 revisions
769 blindly copying data/f2.i containing 1 revisions
771 blindly copying data/f2.i containing 1 revisions
770 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
772 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
771 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
773 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
772 cloning 3 revisions from 00manifest.i
774 cloning 3 revisions from 00manifest.i
773 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
775 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
774 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
776 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
775 blindly copying 00changelog.i containing 3 revisions
777 blindly copying 00changelog.i containing 3 revisions
776 finished migrating 3 changelog revisions; change in size: 0 bytes
778 finished migrating 3 changelog revisions; change in size: 0 bytes
777 finished migrating 9 total revisions; total change in store size: 0 bytes
779 finished migrating 9 total revisions; total change in store size: 0 bytes
778 copying phaseroots
780 copying phaseroots
779 copying requires
781 copying requires
780 data fully upgraded in a temporary repository
782 data fully upgraded in a temporary repository
781 marking source repository as being upgraded; clients will be unable to read from repository
783 marking source repository as being upgraded; clients will be unable to read from repository
782 starting in-place swap of repository data
784 starting in-place swap of repository data
783 replacing store...
785 replacing store...
784 store replacement complete; repository was inconsistent for *s (glob)
786 store replacement complete; repository was inconsistent for *s (glob)
785 finalizing requirements file and making repository readable again
787 finalizing requirements file and making repository readable again
786 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
788 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
787
789
788 Check that the repo still works fine
790 Check that the repo still works fine
789
791
790 $ hg log -G --stat
792 $ hg log -G --stat
791 @ changeset: 2:76d4395f5413 (no-py3 !)
793 @ changeset: 2:76d4395f5413 (no-py3 !)
792 @ changeset: 2:fca376863211 (py3 !)
794 @ changeset: 2:fca376863211 (py3 !)
793 | tag: tip
795 | tag: tip
794 | parent: 0:ba592bf28da2
796 | parent: 0:ba592bf28da2
795 | user: test
797 | user: test
796 | date: Thu Jan 01 00:00:00 1970 +0000
798 | date: Thu Jan 01 00:00:00 1970 +0000
797 | summary: add f2
799 | summary: add f2
798 |
800 |
799 | f2 | 100000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
801 | f2 | 100000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
800 | 1 files changed, 100000 insertions(+), 0 deletions(-)
802 | 1 files changed, 100000 insertions(+), 0 deletions(-)
801 |
803 |
802 | o changeset: 1:2029ce2354e2
804 | o changeset: 1:2029ce2354e2
803 |/ user: test
805 |/ user: test
804 | date: Thu Jan 01 00:00:00 1970 +0000
806 | date: Thu Jan 01 00:00:00 1970 +0000
805 | summary: add f1
807 | summary: add f1
806 |
808 |
807 |
809 |
808 o changeset: 0:ba592bf28da2
810 o changeset: 0:ba592bf28da2
809 user: test
811 user: test
810 date: Thu Jan 01 00:00:00 1970 +0000
812 date: Thu Jan 01 00:00:00 1970 +0000
811 summary: initial
813 summary: initial
812
814
813
815
814
816
815 $ hg verify
817 $ hg verify
816 checking changesets
818 checking changesets
817 checking manifests
819 checking manifests
818 crosschecking files in changesets and manifests
820 crosschecking files in changesets and manifests
819 checking files
821 checking files
820 checked 3 changesets with 3 changes to 3 files
822 checked 3 changesets with 3 changes to 3 files
821
823
822 Check we can select negatively
824 Check we can select negatively
823
825
824 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
826 $ hg debugupgrade --optimize re-delta-parent --run --no-manifest --no-backup --debug --traceback
825 upgrade will perform the following actions:
827 upgrade will perform the following actions:
826
828
827 requirements
829 requirements
828 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
830 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
829 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
831 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
830
832
831 optimisations: re-delta-parent
833 optimisations: re-delta-parent
832
834
833 re-delta-parent
835 re-delta-parent
834 deltas within internal storage will choose a new base revision if needed
836 deltas within internal storage will choose a new base revision if needed
835
837
836 processed revlogs:
838 processed revlogs:
837 - all-filelogs
839 - all-filelogs
838 - changelog
840 - changelog
839
841
840 beginning upgrade...
842 beginning upgrade...
841 repository locked and read-only
843 repository locked and read-only
842 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
844 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
843 (it is safe to interrupt this process any time before data migration completes)
845 (it is safe to interrupt this process any time before data migration completes)
844 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
846 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
845 migrating 519 KB in store; 1.05 MB tracked data
847 migrating 519 KB in store; 1.05 MB tracked data
846 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
848 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
847 cloning 1 revisions from data/FooBarDirectory.d/f1.i
849 cloning 1 revisions from data/FooBarDirectory.d/f1.i
848 cloning 1 revisions from data/f0.i
850 cloning 1 revisions from data/f0.i
849 cloning 1 revisions from data/f2.i
851 cloning 1 revisions from data/f2.i
850 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
852 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
851 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
853 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
852 blindly copying 00manifest.i containing 3 revisions
854 blindly copying 00manifest.i containing 3 revisions
853 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
855 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
854 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
856 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
855 cloning 3 revisions from 00changelog.i
857 cloning 3 revisions from 00changelog.i
856 finished migrating 3 changelog revisions; change in size: 0 bytes
858 finished migrating 3 changelog revisions; change in size: 0 bytes
857 finished migrating 9 total revisions; total change in store size: 0 bytes
859 finished migrating 9 total revisions; total change in store size: 0 bytes
858 copying phaseroots
860 copying phaseroots
859 copying requires
861 copying requires
860 data fully upgraded in a temporary repository
862 data fully upgraded in a temporary repository
861 marking source repository as being upgraded; clients will be unable to read from repository
863 marking source repository as being upgraded; clients will be unable to read from repository
862 starting in-place swap of repository data
864 starting in-place swap of repository data
863 replacing store...
865 replacing store...
864 store replacement complete; repository was inconsistent for *s (glob)
866 store replacement complete; repository was inconsistent for *s (glob)
865 finalizing requirements file and making repository readable again
867 finalizing requirements file and making repository readable again
866 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
868 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
867 $ hg verify
869 $ hg verify
868 checking changesets
870 checking changesets
869 checking manifests
871 checking manifests
870 crosschecking files in changesets and manifests
872 crosschecking files in changesets and manifests
871 checking files
873 checking files
872 checked 3 changesets with 3 changes to 3 files
874 checked 3 changesets with 3 changes to 3 files
873
875
874 Check that we can select changelog only
876 Check that we can select changelog only
875
877
876 $ hg debugupgrade --optimize re-delta-parent --run --changelog --no-backup --debug --traceback
878 $ hg debugupgrade --optimize re-delta-parent --run --changelog --no-backup --debug --traceback
877 upgrade will perform the following actions:
879 upgrade will perform the following actions:
878
880
879 requirements
881 requirements
880 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
882 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
881 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
883 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
882
884
883 optimisations: re-delta-parent
885 optimisations: re-delta-parent
884
886
885 re-delta-parent
887 re-delta-parent
886 deltas within internal storage will choose a new base revision if needed
888 deltas within internal storage will choose a new base revision if needed
887
889
888 processed revlogs:
890 processed revlogs:
889 - changelog
891 - changelog
890
892
891 beginning upgrade...
893 beginning upgrade...
892 repository locked and read-only
894 repository locked and read-only
893 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
895 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
894 (it is safe to interrupt this process any time before data migration completes)
896 (it is safe to interrupt this process any time before data migration completes)
895 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
897 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
896 migrating 519 KB in store; 1.05 MB tracked data
898 migrating 519 KB in store; 1.05 MB tracked data
897 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
899 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
898 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
900 blindly copying data/FooBarDirectory.d/f1.i containing 1 revisions
899 blindly copying data/f0.i containing 1 revisions
901 blindly copying data/f0.i containing 1 revisions
900 blindly copying data/f2.i containing 1 revisions
902 blindly copying data/f2.i containing 1 revisions
901 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
903 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
902 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
904 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
903 blindly copying 00manifest.i containing 3 revisions
905 blindly copying 00manifest.i containing 3 revisions
904 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
906 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
905 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
907 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
906 cloning 3 revisions from 00changelog.i
908 cloning 3 revisions from 00changelog.i
907 finished migrating 3 changelog revisions; change in size: 0 bytes
909 finished migrating 3 changelog revisions; change in size: 0 bytes
908 finished migrating 9 total revisions; total change in store size: 0 bytes
910 finished migrating 9 total revisions; total change in store size: 0 bytes
909 copying phaseroots
911 copying phaseroots
910 copying requires
912 copying requires
911 data fully upgraded in a temporary repository
913 data fully upgraded in a temporary repository
912 marking source repository as being upgraded; clients will be unable to read from repository
914 marking source repository as being upgraded; clients will be unable to read from repository
913 starting in-place swap of repository data
915 starting in-place swap of repository data
914 replacing store...
916 replacing store...
915 store replacement complete; repository was inconsistent for *s (glob)
917 store replacement complete; repository was inconsistent for *s (glob)
916 finalizing requirements file and making repository readable again
918 finalizing requirements file and making repository readable again
917 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
919 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
918 $ hg verify
920 $ hg verify
919 checking changesets
921 checking changesets
920 checking manifests
922 checking manifests
921 crosschecking files in changesets and manifests
923 crosschecking files in changesets and manifests
922 checking files
924 checking files
923 checked 3 changesets with 3 changes to 3 files
925 checked 3 changesets with 3 changes to 3 files
924
926
925 Check that we can select filelog only
927 Check that we can select filelog only
926
928
927 $ hg debugupgrade --optimize re-delta-parent --run --no-changelog --no-manifest --no-backup --debug --traceback
929 $ hg debugupgrade --optimize re-delta-parent --run --no-changelog --no-manifest --no-backup --debug --traceback
928 upgrade will perform the following actions:
930 upgrade will perform the following actions:
929
931
930 requirements
932 requirements
931 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
933 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
932 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
934 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
933
935
934 optimisations: re-delta-parent
936 optimisations: re-delta-parent
935
937
936 re-delta-parent
938 re-delta-parent
937 deltas within internal storage will choose a new base revision if needed
939 deltas within internal storage will choose a new base revision if needed
938
940
939 processed revlogs:
941 processed revlogs:
940 - all-filelogs
942 - all-filelogs
941
943
942 beginning upgrade...
944 beginning upgrade...
943 repository locked and read-only
945 repository locked and read-only
944 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
946 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
945 (it is safe to interrupt this process any time before data migration completes)
947 (it is safe to interrupt this process any time before data migration completes)
946 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
948 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
947 migrating 519 KB in store; 1.05 MB tracked data
949 migrating 519 KB in store; 1.05 MB tracked data
948 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
950 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
949 cloning 1 revisions from data/FooBarDirectory.d/f1.i
951 cloning 1 revisions from data/FooBarDirectory.d/f1.i
950 cloning 1 revisions from data/f0.i
952 cloning 1 revisions from data/f0.i
951 cloning 1 revisions from data/f2.i
953 cloning 1 revisions from data/f2.i
952 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
954 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
953 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
955 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
954 blindly copying 00manifest.i containing 3 revisions
956 blindly copying 00manifest.i containing 3 revisions
955 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
957 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
956 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
958 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
957 blindly copying 00changelog.i containing 3 revisions
959 blindly copying 00changelog.i containing 3 revisions
958 finished migrating 3 changelog revisions; change in size: 0 bytes
960 finished migrating 3 changelog revisions; change in size: 0 bytes
959 finished migrating 9 total revisions; total change in store size: 0 bytes
961 finished migrating 9 total revisions; total change in store size: 0 bytes
960 copying phaseroots
962 copying phaseroots
961 copying requires
963 copying requires
962 data fully upgraded in a temporary repository
964 data fully upgraded in a temporary repository
963 marking source repository as being upgraded; clients will be unable to read from repository
965 marking source repository as being upgraded; clients will be unable to read from repository
964 starting in-place swap of repository data
966 starting in-place swap of repository data
965 replacing store...
967 replacing store...
966 store replacement complete; repository was inconsistent for *s (glob)
968 store replacement complete; repository was inconsistent for *s (glob)
967 finalizing requirements file and making repository readable again
969 finalizing requirements file and making repository readable again
968 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
970 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
969 $ hg verify
971 $ hg verify
970 checking changesets
972 checking changesets
971 checking manifests
973 checking manifests
972 crosschecking files in changesets and manifests
974 crosschecking files in changesets and manifests
973 checking files
975 checking files
974 checked 3 changesets with 3 changes to 3 files
976 checked 3 changesets with 3 changes to 3 files
975
977
976
978
977 Check you can't skip revlog clone during important format downgrade
979 Check you can't skip revlog clone during important format downgrade
978
980
979 $ echo "[format]" > .hg/hgrc
981 $ echo "[format]" > .hg/hgrc
980 $ echo "sparse-revlog=no" >> .hg/hgrc
982 $ echo "sparse-revlog=no" >> .hg/hgrc
981 $ hg debugupgrade --optimize re-delta-parent --no-manifest --no-backup --quiet
983 $ hg debugupgrade --optimize re-delta-parent --no-manifest --no-backup --quiet
982 warning: ignoring --no-manifest, as upgrade is changing: sparserevlog
984 warning: ignoring --no-manifest, as upgrade is changing: sparserevlog
983
985
984 requirements
986 requirements
985 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
987 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
986 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
988 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
987 removed: sparserevlog
989 removed: sparserevlog
988
990
989 optimisations: re-delta-parent
991 optimisations: re-delta-parent
990
992
991 processed revlogs:
993 processed revlogs:
992 - all-filelogs
994 - all-filelogs
993 - changelog
995 - changelog
994 - manifest
996 - manifest
995
997
996 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
998 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
997 note: selecting all-filelogs for processing to change: sparserevlog
999 note: selecting all-filelogs for processing to change: sparserevlog
998 note: selecting changelog for processing to change: sparserevlog
1000 note: selecting changelog for processing to change: sparserevlog
999
1001
1000 upgrade will perform the following actions:
1002 upgrade will perform the following actions:
1001
1003
1002 requirements
1004 requirements
1003 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1005 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1004 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1006 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1005 removed: sparserevlog
1007 removed: sparserevlog
1006
1008
1007 optimisations: re-delta-parent
1009 optimisations: re-delta-parent
1008
1010
1009 re-delta-parent
1011 re-delta-parent
1010 deltas within internal storage will choose a new base revision if needed
1012 deltas within internal storage will choose a new base revision if needed
1011
1013
1012 processed revlogs:
1014 processed revlogs:
1013 - all-filelogs
1015 - all-filelogs
1014 - changelog
1016 - changelog
1015 - manifest
1017 - manifest
1016
1018
1017 beginning upgrade...
1019 beginning upgrade...
1018 repository locked and read-only
1020 repository locked and read-only
1019 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1021 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1020 (it is safe to interrupt this process any time before data migration completes)
1022 (it is safe to interrupt this process any time before data migration completes)
1021 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1023 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1022 migrating 519 KB in store; 1.05 MB tracked data
1024 migrating 519 KB in store; 1.05 MB tracked data
1023 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
1025 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
1024 cloning 1 revisions from data/FooBarDirectory.d/f1.i
1026 cloning 1 revisions from data/FooBarDirectory.d/f1.i
1025 cloning 1 revisions from data/f0.i
1027 cloning 1 revisions from data/f0.i
1026 cloning 1 revisions from data/f2.i
1028 cloning 1 revisions from data/f2.i
1027 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
1029 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
1028 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
1030 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
1029 cloning 3 revisions from 00manifest.i
1031 cloning 3 revisions from 00manifest.i
1030 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1032 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1031 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
1033 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
1032 cloning 3 revisions from 00changelog.i
1034 cloning 3 revisions from 00changelog.i
1033 finished migrating 3 changelog revisions; change in size: 0 bytes
1035 finished migrating 3 changelog revisions; change in size: 0 bytes
1034 finished migrating 9 total revisions; total change in store size: 0 bytes
1036 finished migrating 9 total revisions; total change in store size: 0 bytes
1035 copying phaseroots
1037 copying phaseroots
1036 copying requires
1038 copying requires
1037 data fully upgraded in a temporary repository
1039 data fully upgraded in a temporary repository
1038 marking source repository as being upgraded; clients will be unable to read from repository
1040 marking source repository as being upgraded; clients will be unable to read from repository
1039 starting in-place swap of repository data
1041 starting in-place swap of repository data
1040 replacing store...
1042 replacing store...
1041 store replacement complete; repository was inconsistent for *s (glob)
1043 store replacement complete; repository was inconsistent for *s (glob)
1042 finalizing requirements file and making repository readable again
1044 finalizing requirements file and making repository readable again
1043 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1045 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1044 $ hg verify
1046 $ hg verify
1045 checking changesets
1047 checking changesets
1046 checking manifests
1048 checking manifests
1047 crosschecking files in changesets and manifests
1049 crosschecking files in changesets and manifests
1048 checking files
1050 checking files
1049 checked 3 changesets with 3 changes to 3 files
1051 checked 3 changesets with 3 changes to 3 files
1050
1052
1051 Check you can't skip revlog clone during important format upgrade
1053 Check you can't skip revlog clone during important format upgrade
1052
1054
1053 $ echo "sparse-revlog=yes" >> .hg/hgrc
1055 $ echo "sparse-revlog=yes" >> .hg/hgrc
1054 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
1056 $ hg debugupgrade --optimize re-delta-parent --run --manifest --no-backup --debug --traceback
1055 note: selecting all-filelogs for processing to change: sparserevlog
1057 note: selecting all-filelogs for processing to change: sparserevlog
1056 note: selecting changelog for processing to change: sparserevlog
1058 note: selecting changelog for processing to change: sparserevlog
1057
1059
1058 upgrade will perform the following actions:
1060 upgrade will perform the following actions:
1059
1061
1060 requirements
1062 requirements
1061 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1063 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1062 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1064 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1063 added: sparserevlog
1065 added: sparserevlog
1064
1066
1065 optimisations: re-delta-parent
1067 optimisations: re-delta-parent
1066
1068
1067 sparserevlog
1069 sparserevlog
1068 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
1070 Revlog supports delta chain with more unused data between payload. These gaps will be skipped at read time. This allows for better delta chains, making a better compression and faster exchange with server.
1069
1071
1070 re-delta-parent
1072 re-delta-parent
1071 deltas within internal storage will choose a new base revision if needed
1073 deltas within internal storage will choose a new base revision if needed
1072
1074
1073 processed revlogs:
1075 processed revlogs:
1074 - all-filelogs
1076 - all-filelogs
1075 - changelog
1077 - changelog
1076 - manifest
1078 - manifest
1077
1079
1078 beginning upgrade...
1080 beginning upgrade...
1079 repository locked and read-only
1081 repository locked and read-only
1080 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1082 creating temporary repository to stage upgraded data: $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1081 (it is safe to interrupt this process any time before data migration completes)
1083 (it is safe to interrupt this process any time before data migration completes)
1082 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1084 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1083 migrating 519 KB in store; 1.05 MB tracked data
1085 migrating 519 KB in store; 1.05 MB tracked data
1084 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
1086 migrating 3 filelogs containing 3 revisions (518 KB in store; 1.05 MB tracked data)
1085 cloning 1 revisions from data/FooBarDirectory.d/f1.i
1087 cloning 1 revisions from data/FooBarDirectory.d/f1.i
1086 cloning 1 revisions from data/f0.i
1088 cloning 1 revisions from data/f0.i
1087 cloning 1 revisions from data/f2.i
1089 cloning 1 revisions from data/f2.i
1088 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
1090 finished migrating 3 filelog revisions across 3 filelogs; change in size: 0 bytes
1089 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
1091 migrating 1 manifests containing 3 revisions (367 bytes in store; 238 bytes tracked data)
1090 cloning 3 revisions from 00manifest.i
1092 cloning 3 revisions from 00manifest.i
1091 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1093 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1092 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
1094 migrating changelog containing 3 revisions (394 bytes in store; 199 bytes tracked data)
1093 cloning 3 revisions from 00changelog.i
1095 cloning 3 revisions from 00changelog.i
1094 finished migrating 3 changelog revisions; change in size: 0 bytes
1096 finished migrating 3 changelog revisions; change in size: 0 bytes
1095 finished migrating 9 total revisions; total change in store size: 0 bytes
1097 finished migrating 9 total revisions; total change in store size: 0 bytes
1096 copying phaseroots
1098 copying phaseroots
1097 copying requires
1099 copying requires
1098 data fully upgraded in a temporary repository
1100 data fully upgraded in a temporary repository
1099 marking source repository as being upgraded; clients will be unable to read from repository
1101 marking source repository as being upgraded; clients will be unable to read from repository
1100 starting in-place swap of repository data
1102 starting in-place swap of repository data
1101 replacing store...
1103 replacing store...
1102 store replacement complete; repository was inconsistent for *s (glob)
1104 store replacement complete; repository was inconsistent for *s (glob)
1103 finalizing requirements file and making repository readable again
1105 finalizing requirements file and making repository readable again
1104 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1106 removing temporary repository $TESTTMP/upgradegd/.hg/upgrade.* (glob)
1105 $ hg verify
1107 $ hg verify
1106 checking changesets
1108 checking changesets
1107 checking manifests
1109 checking manifests
1108 crosschecking files in changesets and manifests
1110 crosschecking files in changesets and manifests
1109 checking files
1111 checking files
1110 checked 3 changesets with 3 changes to 3 files
1112 checked 3 changesets with 3 changes to 3 files
1111
1113
1112 $ cd ..
1114 $ cd ..
1113
1115
1114 store files with special filenames aren't encoded during copy
1116 store files with special filenames aren't encoded during copy
1115
1117
1116 $ hg init store-filenames
1118 $ hg init store-filenames
1117 $ cd store-filenames
1119 $ cd store-filenames
1118 $ touch foo
1120 $ touch foo
1119 $ hg -q commit -A -m initial
1121 $ hg -q commit -A -m initial
1120 $ touch .hg/store/.XX_special_filename
1122 $ touch .hg/store/.XX_special_filename
1121
1123
1122 $ hg debugupgraderepo --run
1124 $ hg debugupgraderepo --run
1123 nothing to do
1125 nothing to do
1124 $ hg debugupgraderepo --run --optimize 're-delta-fulladd'
1126 $ hg debugupgraderepo --run --optimize 're-delta-fulladd'
1125 upgrade will perform the following actions:
1127 upgrade will perform the following actions:
1126
1128
1127 requirements
1129 requirements
1128 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
1130 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
1129 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
1131 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
1130
1132
1131 optimisations: re-delta-fulladd
1133 optimisations: re-delta-fulladd
1132
1134
1133 re-delta-fulladd
1135 re-delta-fulladd
1134 each revision will be added as new content to the internal storage; this will likely drastically slow down execution time, but some extensions might need it
1136 each revision will be added as new content to the internal storage; this will likely drastically slow down execution time, but some extensions might need it
1135
1137
1136 processed revlogs:
1138 processed revlogs:
1137 - all-filelogs
1139 - all-filelogs
1138 - changelog
1140 - changelog
1139 - manifest
1141 - manifest
1140
1142
1141 beginning upgrade...
1143 beginning upgrade...
1142 repository locked and read-only
1144 repository locked and read-only
1143 creating temporary repository to stage upgraded data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
1145 creating temporary repository to stage upgraded data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
1144 (it is safe to interrupt this process any time before data migration completes)
1146 (it is safe to interrupt this process any time before data migration completes)
1145 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
1147 migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
1146 migrating 301 bytes in store; 107 bytes tracked data
1148 migrating 301 bytes in store; 107 bytes tracked data
1147 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
1149 migrating 1 filelogs containing 1 revisions (64 bytes in store; 0 bytes tracked data)
1148 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
1150 finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
1149 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
1151 migrating 1 manifests containing 1 revisions (110 bytes in store; 45 bytes tracked data)
1150 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
1152 finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
1151 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
1153 migrating changelog containing 1 revisions (127 bytes in store; 62 bytes tracked data)
1152 finished migrating 1 changelog revisions; change in size: 0 bytes
1154 finished migrating 1 changelog revisions; change in size: 0 bytes
1153 finished migrating 3 total revisions; total change in store size: 0 bytes
1155 finished migrating 3 total revisions; total change in store size: 0 bytes
1154 copying .XX_special_filename
1156 copying .XX_special_filename
1155 copying phaseroots
1157 copying phaseroots
1156 copying requires
1158 copying requires
1157 data fully upgraded in a temporary repository
1159 data fully upgraded in a temporary repository
1158 marking source repository as being upgraded; clients will be unable to read from repository
1160 marking source repository as being upgraded; clients will be unable to read from repository
1159 starting in-place swap of repository data
1161 starting in-place swap of repository data
1160 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
1162 replaced files will be backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
1161 replacing store...
1163 replacing store...
1162 store replacement complete; repository was inconsistent for *s (glob)
1164 store replacement complete; repository was inconsistent for *s (glob)
1163 finalizing requirements file and making repository readable again
1165 finalizing requirements file and making repository readable again
1164 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
1166 removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
1165 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
1167 copy of old repository backed up at $TESTTMP/store-filenames/.hg/upgradebackup.* (glob)
1166 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1168 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1167
1169
1168 fncache is valid after upgrade
1170 fncache is valid after upgrade
1169
1171
1170 $ hg debugrebuildfncache
1172 $ hg debugrebuildfncache
1171 fncache already up to date
1173 fncache already up to date
1172
1174
1173 $ cd ..
1175 $ cd ..
1174
1176
1175 Check upgrading a large file repository
1177 Check upgrading a large file repository
1176 ---------------------------------------
1178 ---------------------------------------
1177
1179
1178 $ hg init largefilesrepo
1180 $ hg init largefilesrepo
1179 $ cat << EOF >> largefilesrepo/.hg/hgrc
1181 $ cat << EOF >> largefilesrepo/.hg/hgrc
1180 > [extensions]
1182 > [extensions]
1181 > largefiles =
1183 > largefiles =
1182 > EOF
1184 > EOF
1183
1185
1184 $ cd largefilesrepo
1186 $ cd largefilesrepo
1185 $ touch foo
1187 $ touch foo
1186 $ hg add --large foo
1188 $ hg add --large foo
1187 $ hg -q commit -m initial
1189 $ hg -q commit -m initial
1188 $ hg debugrequires
1190 $ hg debugrequires
1189 dotencode
1191 dotencode
1190 fncache
1192 fncache
1191 generaldelta
1193 generaldelta
1192 largefiles
1194 largefiles
1193 persistent-nodemap (rust !)
1195 persistent-nodemap (rust !)
1194 revlogv1
1196 revlogv1
1195 share-safe
1197 share-safe
1196 sparserevlog
1198 sparserevlog
1197 store
1199 store
1198
1200
1199 $ hg debugupgraderepo --run
1201 $ hg debugupgraderepo --run
1200 nothing to do
1202 nothing to do
1201 $ hg debugrequires
1203 $ hg debugrequires
1202 dotencode
1204 dotencode
1203 fncache
1205 fncache
1204 generaldelta
1206 generaldelta
1205 largefiles
1207 largefiles
1206 persistent-nodemap (rust !)
1208 persistent-nodemap (rust !)
1207 revlogv1
1209 revlogv1
1208 share-safe
1210 share-safe
1209 sparserevlog
1211 sparserevlog
1210 store
1212 store
1211
1213
1212 $ cat << EOF >> .hg/hgrc
1214 $ cat << EOF >> .hg/hgrc
1213 > [extensions]
1215 > [extensions]
1214 > lfs =
1216 > lfs =
1215 > [lfs]
1217 > [lfs]
1216 > threshold = 10
1218 > threshold = 10
1217 > EOF
1219 > EOF
1218 $ echo '123456789012345' > lfs.bin
1220 $ echo '123456789012345' > lfs.bin
1219 $ hg ci -Am 'lfs.bin'
1221 $ hg ci -Am 'lfs.bin'
1220 adding lfs.bin
1222 adding lfs.bin
1221 $ hg debugrequires | grep lfs
1223 $ hg debugrequires | grep lfs
1222 lfs
1224 lfs
1223 $ find .hg/store/lfs -type f
1225 $ find .hg/store/lfs -type f
1224 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1226 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1225
1227
1226 $ hg debugupgraderepo --run
1228 $ hg debugupgraderepo --run
1227 nothing to do
1229 nothing to do
1228
1230
1229 $ hg debugrequires | grep lfs
1231 $ hg debugrequires | grep lfs
1230 lfs
1232 lfs
1231 $ find .hg/store/lfs -type f
1233 $ find .hg/store/lfs -type f
1232 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1234 .hg/store/lfs/objects/d0/beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1233 $ hg verify
1235 $ hg verify
1234 checking changesets
1236 checking changesets
1235 checking manifests
1237 checking manifests
1236 crosschecking files in changesets and manifests
1238 crosschecking files in changesets and manifests
1237 checking files
1239 checking files
1238 checked 2 changesets with 2 changes to 2 files
1240 checked 2 changesets with 2 changes to 2 files
1239 $ hg debugdata lfs.bin 0
1241 $ hg debugdata lfs.bin 0
1240 version https://git-lfs.github.com/spec/v1
1242 version https://git-lfs.github.com/spec/v1
1241 oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1243 oid sha256:d0beab232adff5ba365880366ad30b1edb85c4c5372442b5d2fe27adc96d653f
1242 size 16
1244 size 16
1243 x-is-binary 0
1245 x-is-binary 0
1244
1246
1245 $ cd ..
1247 $ cd ..
1246
1248
1247 repository config is taken in account
1249 repository config is taken in account
1248 -------------------------------------
1250 -------------------------------------
1249
1251
1250 $ cat << EOF >> $HGRCPATH
1252 $ cat << EOF >> $HGRCPATH
1251 > [format]
1253 > [format]
1252 > maxchainlen = 1
1254 > maxchainlen = 1
1253 > EOF
1255 > EOF
1254
1256
1255 $ hg init localconfig
1257 $ hg init localconfig
1256 $ cd localconfig
1258 $ cd localconfig
1257 $ cat << EOF > file
1259 $ cat << EOF > file
1258 > some content
1260 > some content
1259 > with some length
1261 > with some length
1260 > to make sure we get a delta
1262 > to make sure we get a delta
1261 > after changes
1263 > after changes
1262 > very long
1264 > very long
1263 > very long
1265 > very long
1264 > very long
1266 > very long
1265 > very long
1267 > very long
1266 > very long
1268 > very long
1267 > very long
1269 > very long
1268 > very long
1270 > very long
1269 > very long
1271 > very long
1270 > very long
1272 > very long
1271 > very long
1273 > very long
1272 > very long
1274 > very long
1273 > EOF
1275 > EOF
1274 $ hg -q commit -A -m A
1276 $ hg -q commit -A -m A
1275 $ echo "new line" >> file
1277 $ echo "new line" >> file
1276 $ hg -q commit -m B
1278 $ hg -q commit -m B
1277 $ echo "new line" >> file
1279 $ echo "new line" >> file
1278 $ hg -q commit -m C
1280 $ hg -q commit -m C
1279
1281
1280 $ cat << EOF >> .hg/hgrc
1282 $ cat << EOF >> .hg/hgrc
1281 > [format]
1283 > [format]
1282 > maxchainlen = 9001
1284 > maxchainlen = 9001
1283 > EOF
1285 > EOF
1284 $ hg config format
1286 $ hg config format
1285 format.revlog-compression=$BUNDLE2_COMPRESSIONS$
1287 format.revlog-compression=$BUNDLE2_COMPRESSIONS$
1286 format.maxchainlen=9001
1288 format.maxchainlen=9001
1287 $ hg debugdeltachain file
1289 $ hg debugdeltachain file
1288 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1290 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1289 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1291 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1290 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1292 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1291 2 1 2 0 other 30 200 107 0.53500 128 21 0.19626 128 128 0.83594 1
1293 2 1 2 0 other 30 200 107 0.53500 128 21 0.19626 128 128 0.83594 1
1292
1294
1293 $ hg debugupgraderepo --run --optimize 're-delta-all'
1295 $ hg debugupgraderepo --run --optimize 're-delta-all'
1294 upgrade will perform the following actions:
1296 upgrade will perform the following actions:
1295
1297
1296 requirements
1298 requirements
1297 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
1299 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
1298 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
1300 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
1299
1301
1300 optimisations: re-delta-all
1302 optimisations: re-delta-all
1301
1303
1302 re-delta-all
1304 re-delta-all
1303 deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
1305 deltas within internal storage will be fully recomputed; this will likely drastically slow down execution time
1304
1306
1305 processed revlogs:
1307 processed revlogs:
1306 - all-filelogs
1308 - all-filelogs
1307 - changelog
1309 - changelog
1308 - manifest
1310 - manifest
1309
1311
1310 beginning upgrade...
1312 beginning upgrade...
1311 repository locked and read-only
1313 repository locked and read-only
1312 creating temporary repository to stage upgraded data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
1314 creating temporary repository to stage upgraded data: $TESTTMP/localconfig/.hg/upgrade.* (glob)
1313 (it is safe to interrupt this process any time before data migration completes)
1315 (it is safe to interrupt this process any time before data migration completes)
1314 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1316 migrating 9 total revisions (3 in filelogs, 3 in manifests, 3 in changelog)
1315 migrating 1019 bytes in store; 882 bytes tracked data
1317 migrating 1019 bytes in store; 882 bytes tracked data
1316 migrating 1 filelogs containing 3 revisions (320 bytes in store; 573 bytes tracked data)
1318 migrating 1 filelogs containing 3 revisions (320 bytes in store; 573 bytes tracked data)
1317 finished migrating 3 filelog revisions across 1 filelogs; change in size: -9 bytes
1319 finished migrating 3 filelog revisions across 1 filelogs; change in size: -9 bytes
1318 migrating 1 manifests containing 3 revisions (333 bytes in store; 138 bytes tracked data)
1320 migrating 1 manifests containing 3 revisions (333 bytes in store; 138 bytes tracked data)
1319 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1321 finished migrating 3 manifest revisions across 1 manifests; change in size: 0 bytes
1320 migrating changelog containing 3 revisions (366 bytes in store; 171 bytes tracked data)
1322 migrating changelog containing 3 revisions (366 bytes in store; 171 bytes tracked data)
1321 finished migrating 3 changelog revisions; change in size: 0 bytes
1323 finished migrating 3 changelog revisions; change in size: 0 bytes
1322 finished migrating 9 total revisions; total change in store size: -9 bytes
1324 finished migrating 9 total revisions; total change in store size: -9 bytes
1323 copying phaseroots
1325 copying phaseroots
1324 copying requires
1326 copying requires
1325 data fully upgraded in a temporary repository
1327 data fully upgraded in a temporary repository
1326 marking source repository as being upgraded; clients will be unable to read from repository
1328 marking source repository as being upgraded; clients will be unable to read from repository
1327 starting in-place swap of repository data
1329 starting in-place swap of repository data
1328 replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1330 replaced files will be backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1329 replacing store...
1331 replacing store...
1330 store replacement complete; repository was inconsistent for *s (glob)
1332 store replacement complete; repository was inconsistent for *s (glob)
1331 finalizing requirements file and making repository readable again
1333 finalizing requirements file and making repository readable again
1332 removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
1334 removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob)
1333 copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1335 copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob)
1334 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1336 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
1335 $ hg debugdeltachain file
1337 $ hg debugdeltachain file
1336 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1338 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
1337 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1339 0 1 1 -1 base 77 182 77 0.42308 77 0 0.00000 77 77 1.00000 1
1338 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1340 1 1 2 0 p1 21 191 98 0.51309 98 0 0.00000 98 98 1.00000 1
1339 2 1 3 1 p1 21 200 119 0.59500 119 0 0.00000 119 119 1.00000 1
1341 2 1 3 1 p1 21 200 119 0.59500 119 0 0.00000 119 119 1.00000 1
1340 $ cd ..
1342 $ cd ..
1341
1343
1342 $ cat << EOF >> $HGRCPATH
1344 $ cat << EOF >> $HGRCPATH
1343 > [format]
1345 > [format]
1344 > maxchainlen = 9001
1346 > maxchainlen = 9001
1345 > EOF
1347 > EOF
1346
1348
1347 Check upgrading a sparse-revlog repository
1349 Check upgrading a sparse-revlog repository
1348 ---------------------------------------
1350 ---------------------------------------
1349
1351
1350 $ hg init sparserevlogrepo --config format.sparse-revlog=no
1352 $ hg init sparserevlogrepo --config format.sparse-revlog=no
1351 $ cd sparserevlogrepo
1353 $ cd sparserevlogrepo
1352 $ touch foo
1354 $ touch foo
1353 $ hg add foo
1355 $ hg add foo
1354 $ hg -q commit -m "foo"
1356 $ hg -q commit -m "foo"
1355 $ hg debugrequires
1357 $ hg debugrequires
1356 dotencode
1358 dotencode
1357 fncache
1359 fncache
1358 generaldelta
1360 generaldelta
1359 persistent-nodemap (rust !)
1361 persistent-nodemap (rust !)
1360 revlogv1
1362 revlogv1
1361 share-safe
1363 share-safe
1362 store
1364 store
1363
1365
1364 Check that we can add the sparse-revlog format requirement
1366 Check that we can add the sparse-revlog format requirement
1365 $ hg --config format.sparse-revlog=yes debugupgraderepo --run --quiet
1367 $ hg --config format.sparse-revlog=yes debugupgraderepo --run --quiet
1366 upgrade will perform the following actions:
1368 upgrade will perform the following actions:
1367
1369
1368 requirements
1370 requirements
1369 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1371 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1370 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1372 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1371 added: sparserevlog
1373 added: sparserevlog
1372
1374
1373 processed revlogs:
1375 processed revlogs:
1374 - all-filelogs
1376 - all-filelogs
1375 - changelog
1377 - changelog
1376 - manifest
1378 - manifest
1377
1379
1378 $ hg debugrequires
1380 $ hg debugrequires
1379 dotencode
1381 dotencode
1380 fncache
1382 fncache
1381 generaldelta
1383 generaldelta
1382 persistent-nodemap (rust !)
1384 persistent-nodemap (rust !)
1383 revlogv1
1385 revlogv1
1384 share-safe
1386 share-safe
1385 sparserevlog
1387 sparserevlog
1386 store
1388 store
1387
1389
1388 Check that we can remove the sparse-revlog format requirement
1390 Check that we can remove the sparse-revlog format requirement
1389 $ hg --config format.sparse-revlog=no debugupgraderepo --run --quiet
1391 $ hg --config format.sparse-revlog=no debugupgraderepo --run --quiet
1390 upgrade will perform the following actions:
1392 upgrade will perform the following actions:
1391
1393
1392 requirements
1394 requirements
1393 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1395 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1394 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1396 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1395 removed: sparserevlog
1397 removed: sparserevlog
1396
1398
1397 processed revlogs:
1399 processed revlogs:
1398 - all-filelogs
1400 - all-filelogs
1399 - changelog
1401 - changelog
1400 - manifest
1402 - manifest
1401
1403
1402 $ hg debugrequires
1404 $ hg debugrequires
1403 dotencode
1405 dotencode
1404 fncache
1406 fncache
1405 generaldelta
1407 generaldelta
1406 persistent-nodemap (rust !)
1408 persistent-nodemap (rust !)
1407 revlogv1
1409 revlogv1
1408 share-safe
1410 share-safe
1409 store
1411 store
1410
1412
1411 #if zstd
1413 #if zstd
1412
1414
1413 Check upgrading to a zstd revlog
1415 Check upgrading to a zstd revlog
1414 --------------------------------
1416 --------------------------------
1415
1417
1416 upgrade
1418 upgrade
1417
1419
1418 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup --quiet
1420 $ hg --config format.revlog-compression=zstd debugupgraderepo --run --no-backup --quiet
1419 upgrade will perform the following actions:
1421 upgrade will perform the following actions:
1420
1422
1421 requirements
1423 requirements
1422 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1424 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, store (no-rust !)
1423 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1425 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, store (rust !)
1424 added: revlog-compression-zstd, sparserevlog
1426 added: revlog-compression-zstd, sparserevlog
1425
1427
1426 processed revlogs:
1428 processed revlogs:
1427 - all-filelogs
1429 - all-filelogs
1428 - changelog
1430 - changelog
1429 - manifest
1431 - manifest
1430
1432
1431 $ hg debugformat -v
1433 $ hg debugformat -v
1432 format-variant repo config default
1434 format-variant repo config default
1433 fncache: yes yes yes
1435 fncache: yes yes yes
1434 dirstate-v2: no no no
1436 dirstate-v2: no no no
1435 dotencode: yes yes yes
1437 dotencode: yes yes yes
1436 generaldelta: yes yes yes
1438 generaldelta: yes yes yes
1437 share-safe: yes yes yes
1439 share-safe: yes yes yes
1438 sparserevlog: yes yes yes
1440 sparserevlog: yes yes yes
1439 persistent-nodemap: no no no (no-rust !)
1441 persistent-nodemap: no no no (no-rust !)
1440 persistent-nodemap: yes yes no (rust !)
1442 persistent-nodemap: yes yes no (rust !)
1441 copies-sdc: no no no
1443 copies-sdc: no no no
1442 revlog-v2: no no no
1444 revlog-v2: no no no
1443 changelog-v2: no no no
1445 changelog-v2: no no no
1444 plain-cl-delta: yes yes yes
1446 plain-cl-delta: yes yes yes
1445 compression: zlib zlib zlib (no-zstd !)
1447 compression: zlib zlib zlib (no-zstd !)
1446 compression: zstd zlib zstd (zstd !)
1448 compression: zstd zlib zstd (zstd !)
1447 compression-level: default default default
1449 compression-level: default default default
1448 $ hg debugrequires
1450 $ hg debugrequires
1449 dotencode
1451 dotencode
1450 fncache
1452 fncache
1451 generaldelta
1453 generaldelta
1452 persistent-nodemap (rust !)
1454 persistent-nodemap (rust !)
1453 revlog-compression-zstd
1455 revlog-compression-zstd
1454 revlogv1
1456 revlogv1
1455 share-safe
1457 share-safe
1456 sparserevlog
1458 sparserevlog
1457 store
1459 store
1458
1460
1459 downgrade
1461 downgrade
1460
1462
1461 $ hg debugupgraderepo --run --no-backup --quiet
1463 $ hg debugupgraderepo --run --no-backup --quiet
1462 upgrade will perform the following actions:
1464 upgrade will perform the following actions:
1463
1465
1464 requirements
1466 requirements
1465 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
1467 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
1466 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
1468 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
1467 removed: revlog-compression-zstd
1469 removed: revlog-compression-zstd
1468
1470
1469 processed revlogs:
1471 processed revlogs:
1470 - all-filelogs
1472 - all-filelogs
1471 - changelog
1473 - changelog
1472 - manifest
1474 - manifest
1473
1475
1474 $ hg debugformat -v
1476 $ hg debugformat -v
1475 format-variant repo config default
1477 format-variant repo config default
1476 fncache: yes yes yes
1478 fncache: yes yes yes
1477 dirstate-v2: no no no
1479 dirstate-v2: no no no
1478 dotencode: yes yes yes
1480 dotencode: yes yes yes
1479 generaldelta: yes yes yes
1481 generaldelta: yes yes yes
1480 share-safe: yes yes yes
1482 share-safe: yes yes yes
1481 sparserevlog: yes yes yes
1483 sparserevlog: yes yes yes
1482 persistent-nodemap: no no no (no-rust !)
1484 persistent-nodemap: no no no (no-rust !)
1483 persistent-nodemap: yes yes no (rust !)
1485 persistent-nodemap: yes yes no (rust !)
1484 copies-sdc: no no no
1486 copies-sdc: no no no
1485 revlog-v2: no no no
1487 revlog-v2: no no no
1486 changelog-v2: no no no
1488 changelog-v2: no no no
1487 plain-cl-delta: yes yes yes
1489 plain-cl-delta: yes yes yes
1488 compression: zlib zlib zlib (no-zstd !)
1490 compression: zlib zlib zlib (no-zstd !)
1489 compression: zlib zlib zstd (zstd !)
1491 compression: zlib zlib zstd (zstd !)
1490 compression-level: default default default
1492 compression-level: default default default
1491 $ hg debugrequires
1493 $ hg debugrequires
1492 dotencode
1494 dotencode
1493 fncache
1495 fncache
1494 generaldelta
1496 generaldelta
1495 persistent-nodemap (rust !)
1497 persistent-nodemap (rust !)
1496 revlogv1
1498 revlogv1
1497 share-safe
1499 share-safe
1498 sparserevlog
1500 sparserevlog
1499 store
1501 store
1500
1502
1501 upgrade from hgrc
1503 upgrade from hgrc
1502
1504
1503 $ cat >> .hg/hgrc << EOF
1505 $ cat >> .hg/hgrc << EOF
1504 > [format]
1506 > [format]
1505 > revlog-compression=zstd
1507 > revlog-compression=zstd
1506 > EOF
1508 > EOF
1507 $ hg debugupgraderepo --run --no-backup --quiet
1509 $ hg debugupgraderepo --run --no-backup --quiet
1508 upgrade will perform the following actions:
1510 upgrade will perform the following actions:
1509
1511
1510 requirements
1512 requirements
1511 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
1513 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-rust !)
1512 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
1514 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlogv1, share-safe, sparserevlog, store (rust !)
1513 added: revlog-compression-zstd
1515 added: revlog-compression-zstd
1514
1516
1515 processed revlogs:
1517 processed revlogs:
1516 - all-filelogs
1518 - all-filelogs
1517 - changelog
1519 - changelog
1518 - manifest
1520 - manifest
1519
1521
1520 $ hg debugformat -v
1522 $ hg debugformat -v
1521 format-variant repo config default
1523 format-variant repo config default
1522 fncache: yes yes yes
1524 fncache: yes yes yes
1523 dirstate-v2: no no no
1525 dirstate-v2: no no no
1524 dotencode: yes yes yes
1526 dotencode: yes yes yes
1525 generaldelta: yes yes yes
1527 generaldelta: yes yes yes
1526 share-safe: yes yes yes
1528 share-safe: yes yes yes
1527 sparserevlog: yes yes yes
1529 sparserevlog: yes yes yes
1528 persistent-nodemap: no no no (no-rust !)
1530 persistent-nodemap: no no no (no-rust !)
1529 persistent-nodemap: yes yes no (rust !)
1531 persistent-nodemap: yes yes no (rust !)
1530 copies-sdc: no no no
1532 copies-sdc: no no no
1531 revlog-v2: no no no
1533 revlog-v2: no no no
1532 changelog-v2: no no no
1534 changelog-v2: no no no
1533 plain-cl-delta: yes yes yes
1535 plain-cl-delta: yes yes yes
1534 compression: zlib zlib zlib (no-zstd !)
1536 compression: zlib zlib zlib (no-zstd !)
1535 compression: zstd zstd zstd (zstd !)
1537 compression: zstd zstd zstd (zstd !)
1536 compression-level: default default default
1538 compression-level: default default default
1537 $ hg debugrequires
1539 $ hg debugrequires
1538 dotencode
1540 dotencode
1539 fncache
1541 fncache
1540 generaldelta
1542 generaldelta
1541 persistent-nodemap (rust !)
1543 persistent-nodemap (rust !)
1542 revlog-compression-zstd
1544 revlog-compression-zstd
1543 revlogv1
1545 revlogv1
1544 share-safe
1546 share-safe
1545 sparserevlog
1547 sparserevlog
1546 store
1548 store
1547
1549
1548 #endif
1550 #endif
1549
1551
1550 Check upgrading to a revlog format supporting sidedata
1552 Check upgrading to a revlog format supporting sidedata
1551 ------------------------------------------------------
1553 ------------------------------------------------------
1552
1554
1553 upgrade
1555 upgrade
1554
1556
1555 $ hg debugsidedata -c 0
1557 $ hg debugsidedata -c 0
1556 $ hg --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data debugupgraderepo --run --no-backup --config "extensions.sidedata=$TESTDIR/testlib/ext-sidedata.py" --quiet
1558 $ hg --config experimental.revlogv2=enable-unstable-format-and-corrupt-my-data debugupgraderepo --run --no-backup --config "extensions.sidedata=$TESTDIR/testlib/ext-sidedata.py" --quiet
1557 upgrade will perform the following actions:
1559 upgrade will perform the following actions:
1558
1560
1559 requirements
1561 requirements
1560 preserved: dotencode, fncache, generaldelta, share-safe, store (no-zstd !)
1562 preserved: dotencode, fncache, generaldelta, share-safe, store (no-zstd !)
1561 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, share-safe, sparserevlog, store (zstd no-rust !)
1563 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, share-safe, sparserevlog, store (zstd no-rust !)
1562 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, share-safe, sparserevlog, store (rust !)
1564 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, share-safe, sparserevlog, store (rust !)
1563 removed: revlogv1
1565 removed: revlogv1
1564 added: exp-revlogv2.2 (zstd !)
1566 added: exp-revlogv2.2 (zstd !)
1565 added: exp-revlogv2.2, sparserevlog (no-zstd !)
1567 added: exp-revlogv2.2, sparserevlog (no-zstd !)
1566
1568
1567 processed revlogs:
1569 processed revlogs:
1568 - all-filelogs
1570 - all-filelogs
1569 - changelog
1571 - changelog
1570 - manifest
1572 - manifest
1571
1573
1572 $ hg debugformat -v
1574 $ hg debugformat -v
1573 format-variant repo config default
1575 format-variant repo config default
1574 fncache: yes yes yes
1576 fncache: yes yes yes
1575 dirstate-v2: no no no
1577 dirstate-v2: no no no
1576 dotencode: yes yes yes
1578 dotencode: yes yes yes
1577 generaldelta: yes yes yes
1579 generaldelta: yes yes yes
1578 share-safe: yes yes yes
1580 share-safe: yes yes yes
1579 sparserevlog: yes yes yes
1581 sparserevlog: yes yes yes
1580 persistent-nodemap: no no no (no-rust !)
1582 persistent-nodemap: no no no (no-rust !)
1581 persistent-nodemap: yes yes no (rust !)
1583 persistent-nodemap: yes yes no (rust !)
1582 copies-sdc: no no no
1584 copies-sdc: no no no
1583 revlog-v2: yes no no
1585 revlog-v2: yes no no
1584 changelog-v2: no no no
1586 changelog-v2: no no no
1585 plain-cl-delta: yes yes yes
1587 plain-cl-delta: yes yes yes
1586 compression: zlib zlib zlib (no-zstd !)
1588 compression: zlib zlib zlib (no-zstd !)
1587 compression: zstd zstd zstd (zstd !)
1589 compression: zstd zstd zstd (zstd !)
1588 compression-level: default default default
1590 compression-level: default default default
1589 $ hg debugrequires
1591 $ hg debugrequires
1590 dotencode
1592 dotencode
1591 exp-revlogv2.2
1593 exp-revlogv2.2
1592 fncache
1594 fncache
1593 generaldelta
1595 generaldelta
1594 persistent-nodemap (rust !)
1596 persistent-nodemap (rust !)
1595 revlog-compression-zstd (zstd !)
1597 revlog-compression-zstd (zstd !)
1596 share-safe
1598 share-safe
1597 sparserevlog
1599 sparserevlog
1598 store
1600 store
1599 $ hg debugsidedata -c 0
1601 $ hg debugsidedata -c 0
1600 2 sidedata entries
1602 2 sidedata entries
1601 entry-0001 size 4
1603 entry-0001 size 4
1602 entry-0002 size 32
1604 entry-0002 size 32
1603
1605
1604 downgrade
1606 downgrade
1605
1607
1606 $ hg debugupgraderepo --config experimental.revlogv2=no --run --no-backup --quiet
1608 $ hg debugupgraderepo --config experimental.revlogv2=no --run --no-backup --quiet
1607 upgrade will perform the following actions:
1609 upgrade will perform the following actions:
1608
1610
1609 requirements
1611 requirements
1610 preserved: dotencode, fncache, generaldelta, share-safe, sparserevlog, store (no-zstd !)
1612 preserved: dotencode, fncache, generaldelta, share-safe, sparserevlog, store (no-zstd !)
1611 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, share-safe, sparserevlog, store (zstd no-rust !)
1613 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, share-safe, sparserevlog, store (zstd no-rust !)
1612 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, share-safe, sparserevlog, store (rust !)
1614 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, share-safe, sparserevlog, store (rust !)
1613 removed: exp-revlogv2.2
1615 removed: exp-revlogv2.2
1614 added: revlogv1
1616 added: revlogv1
1615
1617
1616 processed revlogs:
1618 processed revlogs:
1617 - all-filelogs
1619 - all-filelogs
1618 - changelog
1620 - changelog
1619 - manifest
1621 - manifest
1620
1622
1621 $ hg debugformat -v
1623 $ hg debugformat -v
1622 format-variant repo config default
1624 format-variant repo config default
1623 fncache: yes yes yes
1625 fncache: yes yes yes
1624 dirstate-v2: no no no
1626 dirstate-v2: no no no
1625 dotencode: yes yes yes
1627 dotencode: yes yes yes
1626 generaldelta: yes yes yes
1628 generaldelta: yes yes yes
1627 share-safe: yes yes yes
1629 share-safe: yes yes yes
1628 sparserevlog: yes yes yes
1630 sparserevlog: yes yes yes
1629 persistent-nodemap: no no no (no-rust !)
1631 persistent-nodemap: no no no (no-rust !)
1630 persistent-nodemap: yes yes no (rust !)
1632 persistent-nodemap: yes yes no (rust !)
1631 copies-sdc: no no no
1633 copies-sdc: no no no
1632 revlog-v2: no no no
1634 revlog-v2: no no no
1633 changelog-v2: no no no
1635 changelog-v2: no no no
1634 plain-cl-delta: yes yes yes
1636 plain-cl-delta: yes yes yes
1635 compression: zlib zlib zlib (no-zstd !)
1637 compression: zlib zlib zlib (no-zstd !)
1636 compression: zstd zstd zstd (zstd !)
1638 compression: zstd zstd zstd (zstd !)
1637 compression-level: default default default
1639 compression-level: default default default
1638 $ hg debugrequires
1640 $ hg debugrequires
1639 dotencode
1641 dotencode
1640 fncache
1642 fncache
1641 generaldelta
1643 generaldelta
1642 persistent-nodemap (rust !)
1644 persistent-nodemap (rust !)
1643 revlog-compression-zstd (zstd !)
1645 revlog-compression-zstd (zstd !)
1644 revlogv1
1646 revlogv1
1645 share-safe
1647 share-safe
1646 sparserevlog
1648 sparserevlog
1647 store
1649 store
1648 $ hg debugsidedata -c 0
1650 $ hg debugsidedata -c 0
1649
1651
1650 upgrade from hgrc
1652 upgrade from hgrc
1651
1653
1652 $ cat >> .hg/hgrc << EOF
1654 $ cat >> .hg/hgrc << EOF
1653 > [experimental]
1655 > [experimental]
1654 > revlogv2=enable-unstable-format-and-corrupt-my-data
1656 > revlogv2=enable-unstable-format-and-corrupt-my-data
1655 > EOF
1657 > EOF
1656 $ hg debugupgraderepo --run --no-backup --quiet
1658 $ hg debugupgraderepo --run --no-backup --quiet
1657 upgrade will perform the following actions:
1659 upgrade will perform the following actions:
1658
1660
1659 requirements
1661 requirements
1660 preserved: dotencode, fncache, generaldelta, share-safe, sparserevlog, store (no-zstd !)
1662 preserved: dotencode, fncache, generaldelta, share-safe, sparserevlog, store (no-zstd !)
1661 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, share-safe, sparserevlog, store (zstd no-rust !)
1663 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, share-safe, sparserevlog, store (zstd no-rust !)
1662 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, share-safe, sparserevlog, store (rust !)
1664 preserved: dotencode, fncache, generaldelta, persistent-nodemap, revlog-compression-zstd, share-safe, sparserevlog, store (rust !)
1663 removed: revlogv1
1665 removed: revlogv1
1664 added: exp-revlogv2.2
1666 added: exp-revlogv2.2
1665
1667
1666 processed revlogs:
1668 processed revlogs:
1667 - all-filelogs
1669 - all-filelogs
1668 - changelog
1670 - changelog
1669 - manifest
1671 - manifest
1670
1672
1671 $ hg debugformat -v
1673 $ hg debugformat -v
1672 format-variant repo config default
1674 format-variant repo config default
1673 fncache: yes yes yes
1675 fncache: yes yes yes
1674 dirstate-v2: no no no
1676 dirstate-v2: no no no
1675 dotencode: yes yes yes
1677 dotencode: yes yes yes
1676 generaldelta: yes yes yes
1678 generaldelta: yes yes yes
1677 share-safe: yes yes yes
1679 share-safe: yes yes yes
1678 sparserevlog: yes yes yes
1680 sparserevlog: yes yes yes
1679 persistent-nodemap: no no no (no-rust !)
1681 persistent-nodemap: no no no (no-rust !)
1680 persistent-nodemap: yes yes no (rust !)
1682 persistent-nodemap: yes yes no (rust !)
1681 copies-sdc: no no no
1683 copies-sdc: no no no
1682 revlog-v2: yes yes no
1684 revlog-v2: yes yes no
1683 changelog-v2: no no no
1685 changelog-v2: no no no
1684 plain-cl-delta: yes yes yes
1686 plain-cl-delta: yes yes yes
1685 compression: zlib zlib zlib (no-zstd !)
1687 compression: zlib zlib zlib (no-zstd !)
1686 compression: zstd zstd zstd (zstd !)
1688 compression: zstd zstd zstd (zstd !)
1687 compression-level: default default default
1689 compression-level: default default default
1688 $ hg debugrequires
1690 $ hg debugrequires
1689 dotencode
1691 dotencode
1690 exp-revlogv2.2
1692 exp-revlogv2.2
1691 fncache
1693 fncache
1692 generaldelta
1694 generaldelta
1693 persistent-nodemap (rust !)
1695 persistent-nodemap (rust !)
1694 revlog-compression-zstd (zstd !)
1696 revlog-compression-zstd (zstd !)
1695 share-safe
1697 share-safe
1696 sparserevlog
1698 sparserevlog
1697 store
1699 store
1698 $ hg debugsidedata -c 0
1700 $ hg debugsidedata -c 0
1699
1701
1700 Demonstrate that nothing to perform upgrade will still run all the way through
1702 Demonstrate that nothing to perform upgrade will still run all the way through
1701
1703
1702 $ hg debugupgraderepo --run
1704 $ hg debugupgraderepo --run
1703 nothing to do
1705 nothing to do
1704
1706
1705 #if no-rust
1707 #if no-rust
1706
1708
1707 $ cat << EOF >> $HGRCPATH
1709 $ cat << EOF >> $HGRCPATH
1708 > [storage]
1710 > [storage]
1709 > dirstate-v2.slow-path = allow
1711 > dirstate-v2.slow-path = allow
1710 > EOF
1712 > EOF
1711
1713
1712 #endif
1714 #endif
1713
1715
1714 Upgrade to dirstate-v2
1716 Upgrade to dirstate-v2
1715
1717
1716 $ hg debugformat -v --config format.use-dirstate-v2=1 | grep dirstate-v2
1718 $ hg debugformat -v --config format.use-dirstate-v2=1 | grep dirstate-v2
1717 dirstate-v2: no yes no
1719 dirstate-v2: no yes no
1718 $ hg debugupgraderepo --config format.use-dirstate-v2=1 --run
1720 $ hg debugupgraderepo --config format.use-dirstate-v2=1 --run
1719 upgrade will perform the following actions:
1721 upgrade will perform the following actions:
1720
1722
1721 requirements
1723 requirements
1722 preserved: * (glob)
1724 preserved: * (glob)
1723 added: dirstate-v2
1725 added: dirstate-v2
1724
1726
1725 dirstate-v2
1727 dirstate-v2
1726 "hg status" will be faster
1728 "hg status" will be faster
1727
1729
1728 no revlogs to process
1730 no revlogs to process
1729
1731
1730 beginning upgrade...
1732 beginning upgrade...
1731 repository locked and read-only
1733 repository locked and read-only
1732 creating temporary repository to stage upgraded data: $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1734 creating temporary repository to stage upgraded data: $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1733 (it is safe to interrupt this process any time before data migration completes)
1735 (it is safe to interrupt this process any time before data migration completes)
1734 upgrading to dirstate-v2 from v1
1736 upgrading to dirstate-v2 from v1
1735 replaced files will be backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1737 replaced files will be backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1736 removing temporary repository $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1738 removing temporary repository $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1737 $ ls .hg/upgradebackup.*/dirstate
1739 $ ls .hg/upgradebackup.*/dirstate
1738 .hg/upgradebackup.*/dirstate (glob)
1740 .hg/upgradebackup.*/dirstate (glob)
1739 $ hg debugformat -v | grep dirstate-v2
1741 $ hg debugformat -v | grep dirstate-v2
1740 dirstate-v2: yes no no
1742 dirstate-v2: yes no no
1741 $ hg status
1743 $ hg status
1742 $ dd bs=12 count=1 if=.hg/dirstate 2> /dev/null
1744 $ dd bs=12 count=1 if=.hg/dirstate 2> /dev/null
1743 dirstate-v2
1745 dirstate-v2
1744
1746
1745 Downgrade from dirstate-v2
1747 Downgrade from dirstate-v2
1746
1748
1747 $ hg debugupgraderepo --run
1749 $ hg debugupgraderepo --run
1748 upgrade will perform the following actions:
1750 upgrade will perform the following actions:
1749
1751
1750 requirements
1752 requirements
1751 preserved: * (glob)
1753 preserved: * (glob)
1752 removed: dirstate-v2
1754 removed: dirstate-v2
1753
1755
1754 no revlogs to process
1756 no revlogs to process
1755
1757
1756 beginning upgrade...
1758 beginning upgrade...
1757 repository locked and read-only
1759 repository locked and read-only
1758 creating temporary repository to stage upgraded data: $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1760 creating temporary repository to stage upgraded data: $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1759 (it is safe to interrupt this process any time before data migration completes)
1761 (it is safe to interrupt this process any time before data migration completes)
1760 downgrading from dirstate-v2 to v1
1762 downgrading from dirstate-v2 to v1
1761 replaced files will be backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1763 replaced files will be backed up at $TESTTMP/sparserevlogrepo/.hg/upgradebackup.* (glob)
1762 removing temporary repository $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1764 removing temporary repository $TESTTMP/sparserevlogrepo/.hg/upgrade.* (glob)
1763 $ hg debugformat -v | grep dirstate-v2
1765 $ hg debugformat -v | grep dirstate-v2
1764 dirstate-v2: no no no
1766 dirstate-v2: no no no
1765 $ hg status
1767 $ hg status
1766
1768
1767 $ cd ..
1769 $ cd ..
1768
1770
1769 dirstate-v2: upgrade and downgrade from and empty repository:
1771 dirstate-v2: upgrade and downgrade from and empty repository:
1770 -------------------------------------------------------------
1772 -------------------------------------------------------------
1771
1773
1772 $ hg init --config format.use-dirstate-v2=no dirstate-v2-empty
1774 $ hg init --config format.use-dirstate-v2=no dirstate-v2-empty
1773 $ cd dirstate-v2-empty
1775 $ cd dirstate-v2-empty
1774 $ hg debugformat | grep dirstate-v2
1776 $ hg debugformat | grep dirstate-v2
1775 dirstate-v2: no
1777 dirstate-v2: no
1776
1778
1777 upgrade
1779 upgrade
1778
1780
1779 $ hg debugupgraderepo --run --config format.use-dirstate-v2=yes
1781 $ hg debugupgraderepo --run --config format.use-dirstate-v2=yes
1780 upgrade will perform the following actions:
1782 upgrade will perform the following actions:
1781
1783
1782 requirements
1784 requirements
1783 preserved: * (glob)
1785 preserved: * (glob)
1784 added: dirstate-v2
1786 added: dirstate-v2
1785
1787
1786 dirstate-v2
1788 dirstate-v2
1787 "hg status" will be faster
1789 "hg status" will be faster
1788
1790
1789 no revlogs to process
1791 no revlogs to process
1790
1792
1791 beginning upgrade...
1793 beginning upgrade...
1792 repository locked and read-only
1794 repository locked and read-only
1793 creating temporary repository to stage upgraded data: $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
1795 creating temporary repository to stage upgraded data: $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
1794 (it is safe to interrupt this process any time before data migration completes)
1796 (it is safe to interrupt this process any time before data migration completes)
1795 upgrading to dirstate-v2 from v1
1797 upgrading to dirstate-v2 from v1
1796 replaced files will be backed up at $TESTTMP/dirstate-v2-empty/.hg/upgradebackup.* (glob)
1798 replaced files will be backed up at $TESTTMP/dirstate-v2-empty/.hg/upgradebackup.* (glob)
1797 removing temporary repository $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
1799 removing temporary repository $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
1798 $ hg debugformat | grep dirstate-v2
1800 $ hg debugformat | grep dirstate-v2
1799 dirstate-v2: yes
1801 dirstate-v2: yes
1800
1802
1801 downgrade
1803 downgrade
1802
1804
1803 $ hg debugupgraderepo --run --config format.use-dirstate-v2=no
1805 $ hg debugupgraderepo --run --config format.use-dirstate-v2=no
1804 upgrade will perform the following actions:
1806 upgrade will perform the following actions:
1805
1807
1806 requirements
1808 requirements
1807 preserved: * (glob)
1809 preserved: * (glob)
1808 removed: dirstate-v2
1810 removed: dirstate-v2
1809
1811
1810 no revlogs to process
1812 no revlogs to process
1811
1813
1812 beginning upgrade...
1814 beginning upgrade...
1813 repository locked and read-only
1815 repository locked and read-only
1814 creating temporary repository to stage upgraded data: $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
1816 creating temporary repository to stage upgraded data: $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
1815 (it is safe to interrupt this process any time before data migration completes)
1817 (it is safe to interrupt this process any time before data migration completes)
1816 downgrading from dirstate-v2 to v1
1818 downgrading from dirstate-v2 to v1
1817 replaced files will be backed up at $TESTTMP/dirstate-v2-empty/.hg/upgradebackup.* (glob)
1819 replaced files will be backed up at $TESTTMP/dirstate-v2-empty/.hg/upgradebackup.* (glob)
1818 removing temporary repository $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
1820 removing temporary repository $TESTTMP/dirstate-v2-empty/.hg/upgrade.* (glob)
1819 $ hg debugformat | grep dirstate-v2
1821 $ hg debugformat | grep dirstate-v2
1820 dirstate-v2: no
1822 dirstate-v2: no
1821
1823
1822 $ cd ..
1824 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now