Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 46235:0babe12ef35d
sharesafe: introduce functionality to automatically upgrade shares
In past few months, we have developed a `share-safe` mode for sharing repository
in which share source requirements and config values are shared with the shares.
To get it rolling, an important task is to get these shares automatically
upgraded. We are focusing on an installation where shares are created by scripts
and test jobs. It will be difficult to manually upgrade these and we need some
functionality to do so automatically.
This patch introduces a config option to deal with it. If all of the following
conditions are met, we upgrade the share repository automatically:
* If the config option is enabled
* Share source repository is share-safe enabled
* Share is not share-safe enabled
* Any command is run in the share
Upgrading the share is pretty easy as it involves only editing the requirements
file.
Differential Revision: https://phab.mercurial-scm.org/D9679
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 06 Jan 2021 16:18:06 +0530 |
parents | 9804162a4053 |
children | eec47efe219d |
comparison
equal
deleted
inserted
replaced
46234:9804162a4053 | 46235:0babe12ef35d |
---|---|
580 | 580 |
581 requirements |= _readrequires(storevfs, False) | 581 requirements |= _readrequires(storevfs, False) |
582 elif shared: | 582 elif shared: |
583 sourcerequires = _readrequires(sharedvfs, False) | 583 sourcerequires = _readrequires(sharedvfs, False) |
584 if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires: | 584 if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires: |
585 ui.warn( | 585 if ui.configbool(b'experimental', b'sharesafe-auto-upgrade-shares'): |
586 _( | 586 # prevent cyclic import localrepo -> upgrade -> localrepo |
587 b'warning: source repository supports share-safe functionality.' | 587 from . import upgrade |
588 b' Reshare to upgrade.\n' | 588 |
589 upgrade.upgrade_share_to_safe( | |
590 ui, | |
591 hgvfs, | |
592 storevfs, | |
593 requirements, | |
589 ) | 594 ) |
590 ) | 595 else: |
596 ui.warn( | |
597 _( | |
598 b'warning: source repository supports share-safe functionality.' | |
599 b' Reshare to upgrade.\n' | |
600 ) | |
601 ) | |
591 | 602 |
592 # The .hg/hgrc file may load extensions or contain config options | 603 # The .hg/hgrc file may load extensions or contain config options |
593 # that influence repository construction. Attempt to load it and | 604 # that influence repository construction. Attempt to load it and |
594 # process any new extensions that it may have pulled in. | 605 # process any new extensions that it may have pulled in. |
595 if loadhgrc(ui, wdirvfs, hgvfs, requirements, sharedvfs): | 606 if loadhgrc(ui, wdirvfs, hgvfs, requirements, sharedvfs): |