Mercurial > hg
comparison mercurial/requirements.py @ 45483:d252f51ab032
share: introduce config option to store requires in .hg/store
This introduces a config option which enabled stores the requirements on a
repository in store instead.
When enabled, `.hg/requires` will contain the `share-safe` requirement which
marks that the requirements are present in the store.
This is done so that repository requirements can be shared with shares made
using `hg share` command.
After this patch, `hg share` checks whether the source repository has
share-safe requirement, if yes, it does not copy the requirements.
Test for the new functionality is added and a test case in exitsing share tests
is also added.
Differential Revision: https://phab.mercurial-scm.org/D8633
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 14 Apr 2020 21:07:09 +0530 |
parents | 034d94f8761b |
children | 4b0192f592cf |
comparison
equal
deleted
inserted
replaced
45482:9a99ab8217bd | 45483:d252f51ab032 |
---|---|
50 | 50 |
51 # Denotes that current repository is a share and the shared source path is | 51 # Denotes that current repository is a share and the shared source path is |
52 # relative to the current repository root path | 52 # relative to the current repository root path |
53 RELATIVE_SHARED_REQUIREMENT = b'relshared' | 53 RELATIVE_SHARED_REQUIREMENT = b'relshared' |
54 | 54 |
55 # A repository with share implemented safely. The repository has different | |
56 # store and working copy requirements i.e. both `.hg/requires` and | |
57 # `.hg/store/requires` are present. | |
58 SHARESAFE_REQUIREMENT = b'exp-sharesafe' | |
59 | |
55 # List of requirements which are working directory specific | 60 # List of requirements which are working directory specific |
56 # These requirements cannot be shared between repositories if they | 61 # These requirements cannot be shared between repositories if they |
57 # share the same store | 62 # share the same store |
58 # * sparse is a working directory specific functionality and hence working | 63 # * sparse is a working directory specific functionality and hence working |
59 # directory specific requirement | 64 # directory specific requirement |
60 # * SHARED_REQUIREMENT and RELATIVE_SHARED_REQUIREMENT are requirements which | 65 # * SHARED_REQUIREMENT and RELATIVE_SHARED_REQUIREMENT are requirements which |
61 # represents that the current working copy/repository shares store of another | 66 # represents that the current working copy/repository shares store of another |
62 # repo. Hence both of them should be stored in working copy | 67 # repo. Hence both of them should be stored in working copy |
68 # * SHARESAFE_REQUIREMENT needs to be stored in working dir to mark that rest of | |
69 # the requirements are stored in store's requires | |
63 WORKING_DIR_REQUIREMENTS = { | 70 WORKING_DIR_REQUIREMENTS = { |
64 SPARSE_REQUIREMENT, | 71 SPARSE_REQUIREMENT, |
65 SHARED_REQUIREMENT, | 72 SHARED_REQUIREMENT, |
66 RELATIVE_SHARED_REQUIREMENT, | 73 RELATIVE_SHARED_REQUIREMENT, |
74 SHARESAFE_REQUIREMENT, | |
67 } | 75 } |