1# requirements.py - objects and functions related to repository requirements
2#
3# Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
4#
5# This software may be used and distributed according to the terms of the
6# GNU General Public License version 2 or any later version.
7
8from __future__ import absolute_import
9
10GENERALDELTA_REQUIREMENT = b'generaldelta'
11DOTENCODE_REQUIREMENT = b'dotencode'
12STORE_REQUIREMENT = b'store'
13FNCACHE_REQUIREMENT = b'fncache'
14
15DIRSTATE_V2_REQUIREMENT = b'dirstate-v2'
16
17# When narrowing is finalized and no longer subject to format changes,
18# we should move this to just "narrow" or similar.
19NARROW_REQUIREMENT = b'narrowhg-experimental'
20
21# Enables sparse working directory usage
22SPARSE_REQUIREMENT = b'exp-sparse'
23
24# Enables the internal phase which is used to hide changesets instead
25# of stripping them
26INTERNAL_PHASE_REQUIREMENT = b'internal-phase'
27
28# Stores manifest in Tree structure
29TREEMANIFEST_REQUIREMENT = b'treemanifest'
30
31REVLOGV1_REQUIREMENT = b'revlogv1'
32
33# Increment the sub-version when the revlog v2 format changes to lock out old
34# clients.
35CHANGELOGV2_REQUIREMENT = b'exp-changelog-v2'
36
37# Increment the sub-version when the revlog v2 format changes to lock out old
38# clients.
39REVLOGV2_REQUIREMENT = b'exp-revlogv2.2'
40
41# A repository with the sparserevlog feature will have delta chains that
42# can spread over a larger span. Sparse reading cuts these large spans into
43# pieces, so that each piece isn't too big.
44# Without the sparserevlog capability, reading from the repository could use
45# huge amounts of memory, because the whole span would be read at once,
46# including all the intermediate revisions that aren't pertinent for the chain.
47# This is why once a repository has enabled sparse-read, it becomes required.
48SPARSEREVLOG_REQUIREMENT = b'sparserevlog'
49
50# A repository with the the copies-sidedata-changeset requirement will store
51# copies related information in changeset's sidedata.
52COPIESSDC_REQUIREMENT = b'exp-copies-sidedata-changeset'
53
54# The repository use persistent nodemap for the changelog and the manifest.
55NODEMAP_REQUIREMENT = b'persistent-nodemap'
56
57# Denotes that the current repository is a share
58SHARED_REQUIREMENT = b'shared'
59
60# Denotes that current repository is a share and the shared source path is
61# relative to the current repository root path
62RELATIVE_SHARED_REQUIREMENT = b'relshared'
63
64# A repository with share implemented safely. The repository has different
65# store and working copy requirements i.e. both `.hg/requires` and
66# `.hg/store/requires` are present.
67SHARESAFE_REQUIREMENT = b'share-safe'
68
69# List of requirements which are working directory specific
70# These requirements cannot be shared between repositories if they
71# share the same store
72# * sparse is a working directory specific functionality and hence working
73#   directory specific requirement
74# * SHARED_REQUIREMENT and RELATIVE_SHARED_REQUIREMENT are requirements which
75#   represents that the current working copy/repository shares store of another
76#   repo. Hence both of them should be stored in working copy
77# * SHARESAFE_REQUIREMENT needs to be stored in working dir to mark that rest of
78#   the requirements are stored in store's requires
79# * DIRSTATE_V2_REQUIREMENT affects .hg/dirstate, of which there is one per
80#   working directory.
81WORKING_DIR_REQUIREMENTS = {
82    SPARSE_REQUIREMENT,
83    SHARED_REQUIREMENT,
84    RELATIVE_SHARED_REQUIREMENT,
85    SHARESAFE_REQUIREMENT,
86    DIRSTATE_V2_REQUIREMENT,
87}
88