Mercurial > public > mercurial-scm > hg
comparison mercurial/upgrade.py @ 46002:705c37f22859
upgrade: add support for experimental safe share mode
Recently we introduce the share-safe functionality which makes shares share
requirements and config of share source. This patch adds support to
`debugupgraderepo` command to upgrade repository to share-safe mode when
`format.exp-share-safe` config is enabled.
Differential Revision: https://phab.mercurial-scm.org/D9144
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 25 Jun 2020 13:13:21 +0530 |
parents | 7c539f0febbe |
children | c6a1fa42e325 |
comparison
equal
deleted
inserted
replaced
46001:aab70f05d6ec | 46002:705c37f22859 |
---|---|
135 b'generaldelta', | 135 b'generaldelta', |
136 requirements.SPARSEREVLOG_REQUIREMENT, | 136 requirements.SPARSEREVLOG_REQUIREMENT, |
137 requirements.SIDEDATA_REQUIREMENT, | 137 requirements.SIDEDATA_REQUIREMENT, |
138 requirements.COPIESSDC_REQUIREMENT, | 138 requirements.COPIESSDC_REQUIREMENT, |
139 requirements.NODEMAP_REQUIREMENT, | 139 requirements.NODEMAP_REQUIREMENT, |
140 requirements.SHARESAFE_REQUIREMENT, | |
140 } | 141 } |
141 for name in compression.compengines: | 142 for name in compression.compengines: |
142 engine = compression.compengines[name] | 143 engine = compression.compengines[name] |
143 if engine.available() and engine.revlogheader(): | 144 if engine.available() and engine.revlogheader(): |
144 supported.add(b'exp-compression-%s' % name) | 145 supported.add(b'exp-compression-%s' % name) |
331 b'smaller and read times should decrease; ' | 332 b'smaller and read times should decrease; ' |
332 b'interacting with other repositories using this ' | 333 b'interacting with other repositories using this ' |
333 b'storage model should require less network and ' | 334 b'storage model should require less network and ' |
334 b'CPU resources, making "hg push" and "hg pull" ' | 335 b'CPU resources, making "hg push" and "hg pull" ' |
335 b'faster' | 336 b'faster' |
337 ) | |
338 | |
339 | |
340 @registerformatvariant | |
341 class sharedsafe(requirementformatvariant): | |
342 name = b'exp-sharesafe' | |
343 _requirement = requirements.SHARESAFE_REQUIREMENT | |
344 | |
345 default = False | |
346 | |
347 description = _( | |
348 b'old shared repositories do not share source repository ' | |
349 b'requirements and config. This leads to various problems ' | |
350 b'when the source repository format is upgraded or some new ' | |
351 b'extensions are enabled.' | |
352 ) | |
353 | |
354 upgrademessage = _( | |
355 b'Upgrades a repository to share-safe format so that future ' | |
356 b'shares of this repository share its requirements and configs.' | |
336 ) | 357 ) |
337 | 358 |
338 | 359 |
339 @registerformatvariant | 360 @registerformatvariant |
340 class sparserevlog(requirementformatvariant): | 361 class sparserevlog(requirementformatvariant): |
1437 b'the old repository will not be deleted; remove ' | 1458 b'the old repository will not be deleted; remove ' |
1438 b'it to free up disk space once the upgraded ' | 1459 b'it to free up disk space once the upgraded ' |
1439 b'repository is verified\n' | 1460 b'repository is verified\n' |
1440 ) | 1461 ) |
1441 ) | 1462 ) |
1463 | |
1464 if sharedsafe.name in addedreqs: | |
1465 ui.warn( | |
1466 _( | |
1467 b'repository upgraded to share safe mode, existing' | |
1468 b' shares will still work in old non-safe mode. ' | |
1469 b'Re-share existing shares to use them in safe mode' | |
1470 b' New shares will be created in safe mode.\n' | |
1471 ) | |
1472 ) |