mercurial/requirements.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Mon, 19 Apr 2021 11:22:24 +0200
changeset 47105 bc7bdca15e47
parent 46819 d4ba4d51f85f
child 47240 21b3e6116bd1
permissions -rw-r--r--
test-copies: test that copies' sidedata can get computed during push If the source of the push does not have the necessary sidedata but the server needs them, the client should compute them on the fly while pushing. Differential Revision: https://phab.mercurial-scm.org/D10350
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45392
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     1
# requirements.py - objects and functions related to repository requirements
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     2
#
46819
d4ba4d51f85f contributor: change mentions of mpm to olivia
Raphaël Gomès <rgomes@octobus.net>
parents: 46717
diff changeset
     3
# Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
45392
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     4
#
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     5
# This software may be used and distributed according to the terms of the
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     6
# GNU General Public License version 2 or any later version.
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     7
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     8
from __future__ import absolute_import
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     9
46666
f4c325bf80fc requirements: also add a generaldelta constant
Raphaël Gomès <rgomes@octobus.net>
parents: 46665
diff changeset
    10
GENERALDELTA_REQUIREMENT = b'generaldelta'
46675
c3773636ddbb requirements: also add a dotencode constant
Raphaël Gomès <rgomes@octobus.net>
parents: 46666
diff changeset
    11
DOTENCODE_REQUIREMENT = b'dotencode'
46676
ab58098bebed requirements: also add a store constant
Raphaël Gomès <rgomes@octobus.net>
parents: 46675
diff changeset
    12
STORE_REQUIREMENT = b'store'
46677
b4c2a2af25e2 requirements: also add a fncache constant
Raphaël Gomès <rgomes@octobus.net>
parents: 46676
diff changeset
    13
FNCACHE_REQUIREMENT = b'fncache'
46666
f4c325bf80fc requirements: also add a generaldelta constant
Raphaël Gomès <rgomes@octobus.net>
parents: 46665
diff changeset
    14
45392
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    15
# When narrowing is finalized and no longer subject to format changes,
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    16
# we should move this to just "narrow" or similar.
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    17
NARROW_REQUIREMENT = b'narrowhg-experimental'
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    18
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    19
# Enables sparse working directory usage
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    20
SPARSE_REQUIREMENT = b'exp-sparse'
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    21
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    22
# Enables the internal phase which is used to hide changesets instead
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    23
# of stripping them
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    24
INTERNAL_PHASE_REQUIREMENT = b'internal-phase'
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    25
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    26
# Stores manifest in Tree structure
77b8588dd84e requirements: introduce new requirements related module
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    27
TREEMANIFEST_REQUIREMENT = b'treemanifest'
45393
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    28
46665
ee91966aec0f requirements: add constant for revlog v1 requirement
Raphaël Gomès <rgomes@octobus.net>
parents: 46334
diff changeset
    29
REVLOGV1_REQUIREMENT = b'revlogv1'
ee91966aec0f requirements: add constant for revlog v1 requirement
Raphaël Gomès <rgomes@octobus.net>
parents: 46334
diff changeset
    30
45393
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    31
# Increment the sub-version when the revlog v2 format changes to lock out old
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    32
# clients.
46717
913485776542 revlog: introduce v2 format
Raphaël Gomès <rgomes@octobus.net>
parents: 46677
diff changeset
    33
REVLOGV2_REQUIREMENT = b'exp-revlogv2.2'
45393
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    34
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    35
# A repository with the sparserevlog feature will have delta chains that
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    36
# can spread over a larger span. Sparse reading cuts these large spans into
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    37
# pieces, so that each piece isn't too big.
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    38
# Without the sparserevlog capability, reading from the repository could use
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    39
# huge amounts of memory, because the whole span would be read at once,
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    40
# including all the intermediate revisions that aren't pertinent for the chain.
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    41
# This is why once a repository has enabled sparse-read, it becomes required.
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    42
SPARSEREVLOG_REQUIREMENT = b'sparserevlog'
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    43
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    44
# A repository with the sidedataflag requirement will allow to store extra
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    45
# information for revision without altering their original hashes.
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    46
SIDEDATA_REQUIREMENT = b'exp-sidedata-flag'
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    47
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    48
# A repository with the the copies-sidedata-changeset requirement will store
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    49
# copies related information in changeset's sidedata.
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    50
COPIESSDC_REQUIREMENT = b'exp-copies-sidedata-changeset'
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    51
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    52
# The repository use persistent nodemap for the changelog and the manifest.
d7dcc75a3eae localrepo: move requirements constant to requirements module
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45392
diff changeset
    53
NODEMAP_REQUIREMENT = b'persistent-nodemap'
45394
bd56597b2254 requirements: introduce a set of working directory specific requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45393
diff changeset
    54
45406
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    55
# Denotes that the current repository is a share
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    56
SHARED_REQUIREMENT = b'shared'
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    57
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    58
# Denotes that current repository is a share and the shared source path is
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    59
# relative to the current repository root path
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    60
RELATIVE_SHARED_REQUIREMENT = b'relshared'
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    61
45494
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45406
diff changeset
    62
# A repository with share implemented safely. The repository has different
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45406
diff changeset
    63
# store and working copy requirements i.e. both `.hg/requires` and
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45406
diff changeset
    64
# `.hg/store/requires` are present.
46334
6e81446bf1d9 share: move share safe functionality out of experimental
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45494
diff changeset
    65
SHARESAFE_REQUIREMENT = b'share-safe'
45494
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45406
diff changeset
    66
45394
bd56597b2254 requirements: introduce a set of working directory specific requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45393
diff changeset
    67
# List of requirements which are working directory specific
bd56597b2254 requirements: introduce a set of working directory specific requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45393
diff changeset
    68
# These requirements cannot be shared between repositories if they
bd56597b2254 requirements: introduce a set of working directory specific requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45393
diff changeset
    69
# share the same store
45406
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    70
# * sparse is a working directory specific functionality and hence working
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    71
#   directory specific requirement
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    72
# * SHARED_REQUIREMENT and RELATIVE_SHARED_REQUIREMENT are requirements which
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    73
#   represents that the current working copy/repository shares store of another
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    74
#   repo. Hence both of them should be stored in working copy
45494
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45406
diff changeset
    75
# * SHARESAFE_REQUIREMENT needs to be stored in working dir to mark that rest of
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45406
diff changeset
    76
#   the requirements are stored in store's requires
45406
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    77
WORKING_DIR_REQUIREMENTS = {
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    78
    SPARSE_REQUIREMENT,
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    79
    SHARED_REQUIREMENT,
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    80
    RELATIVE_SHARED_REQUIREMENT,
45494
d252f51ab032 share: introduce config option to store requires in .hg/store
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45406
diff changeset
    81
    SHARESAFE_REQUIREMENT,
45406
034d94f8761b requirements: introduce constants for `shared` and `relshared` requirements
Pulkit Goyal <7895pulkit@gmail.com>
parents: 45394
diff changeset
    82
}