diff 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
line wrap: on
line diff
--- a/mercurial/requirements.py	Fri Aug 07 16:11:19 2020 +0530
+++ b/mercurial/requirements.py	Tue Apr 14 21:07:09 2020 +0530
@@ -52,6 +52,11 @@
 # relative to the current repository root path
 RELATIVE_SHARED_REQUIREMENT = b'relshared'
 
+# A repository with share implemented safely. The repository has different
+# store and working copy requirements i.e. both `.hg/requires` and
+# `.hg/store/requires` are present.
+SHARESAFE_REQUIREMENT = b'exp-sharesafe'
+
 # List of requirements which are working directory specific
 # These requirements cannot be shared between repositories if they
 # share the same store
@@ -60,8 +65,11 @@
 # * SHARED_REQUIREMENT and RELATIVE_SHARED_REQUIREMENT are requirements which
 #   represents that the current working copy/repository shares store of another
 #   repo. Hence both of them should be stored in working copy
+# * SHARESAFE_REQUIREMENT needs to be stored in working dir to mark that rest of
+#   the requirements are stored in store's requires
 WORKING_DIR_REQUIREMENTS = {
     SPARSE_REQUIREMENT,
     SHARED_REQUIREMENT,
     RELATIVE_SHARED_REQUIREMENT,
+    SHARESAFE_REQUIREMENT,
 }