comparison mercurial/localrepo.py @ 49192:2ab79873786e

auto-upgrade: introduce a way to auto-upgrade to/from share-safe This is the first "automatic-upgrade" capability. In the following commits, similar features are coming for other "fast to upgrade" formats. This is different from the `safe-mismatch.source-not-safe` and `safe-mismatch.source-safe` configuration that deal with mismatch between a share and its share-source. Here we are dealing with mismatch between a repository configuration and its actual format. We will need further work for cases were the repository cannot be locked. A basic protection is in place to avoid a infinite loop for now, but it will get proper attention in a later changeset. Differential Revision: https://phab.mercurial-scm.org/D12611
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 05 Apr 2022 05:19:47 +0200
parents a932cad26d37
children 2bcf5e14bb7e
comparison
equal deleted inserted replaced
49191:4450faeb52bb 49192:2ab79873786e
3514 assert name.startswith(b'journal') 3514 assert name.startswith(b'journal')
3515 return os.path.join(base, name.replace(b'journal', b'undo', 1)) 3515 return os.path.join(base, name.replace(b'journal', b'undo', 1))
3516 3516
3517 3517
3518 def instance(ui, path, create, intents=None, createopts=None): 3518 def instance(ui, path, create, intents=None, createopts=None):
3519
3520 # prevent cyclic import localrepo -> upgrade -> localrepo
3521 from . import upgrade
3522
3519 localpath = urlutil.urllocalpath(path) 3523 localpath = urlutil.urllocalpath(path)
3520 if create: 3524 if create:
3521 createrepository(ui, localpath, createopts=createopts) 3525 createrepository(ui, localpath, createopts=createopts)
3522 3526
3523 return makelocalrepository(ui, localpath, intents=intents) 3527 def repo_maker():
3528 return makelocalrepository(ui, localpath, intents=intents)
3529
3530 repo = repo_maker()
3531 repo = upgrade.may_auto_upgrade(repo, repo_maker)
3532 return repo
3524 3533
3525 3534
3526 def islocal(path): 3535 def islocal(path):
3527 return True 3536 return True
3528 3537