Mercurial > public > mercurial-scm > hg
annotate rust/hg-core/src/requirements.rs @ 52664:f5091286b10c
packaging: modernize (compat PEP 517) with less distutils and setup.py calls
- setup.py: less distutils imports and setuptools required
distutils is deprecated and one should import commands from setuptools to support
modern workflows depending on PEP 517 and 518.
Moreover, for Python >=3.12, distutils comes from setuptools. It corresponds to old and
unmaintain code that do not support PEP 517.
The PEP 517 frontends (pip, build, pipx, PDM, UV, etc.) are responsible for creating a
venv just for the build. The build dependencies (currently only setuptools) are specified
in the pyproject.toml file. Therefore, there is no reason to support building without
setuptools.
Calling directly setup.py is deprecated and we have to use a PEP 517 frontend.
For this commit we use pip with venv.
- run-tests.py: install with pip instead of direct call of setup.py
Mercurial is then built in an isolated environment.
- Makefile: use venv+pip instead of setup.py
author | paugier <pierre.augier@univ-grenoble-alpes.fr> |
---|---|
date | Wed, 08 Jan 2025 05:07:00 +0100 |
parents | db7dbe6f7bb2 |
children | 94e2547e6f3d |
rev | line source |
---|---|
46443
43d63979a75e
rust: use HgError in RevlogError and Vfs
Simon Sapin <simon.sapin@octobus.net>
parents:
46442
diff
changeset
|
1 use crate::errors::{HgError, HgResultExt}; |
47952
9cd35c8c6044
rust: Move VFS code to its own module
Simon Sapin <simon.sapin@octobus.net>
parents:
47374
diff
changeset
|
2 use crate::repo::Repo; |
46614
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
3 use crate::utils::join_display; |
51864 | 4 use crate::vfs::VfsImpl; |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
5 use std::collections::HashSet; |
45924
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
6 |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
7 fn parse(bytes: &[u8]) -> Result<HashSet<String>, HgError> { |
45924
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
8 // The Python code reading this file uses `str.splitlines` |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
9 // which looks for a number of line separators (even including a couple of |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
10 // non-ASCII ones), but Python code writing it always uses `\n`. |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
11 let lines = bytes.split(|&byte| byte == b'\n'); |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
12 |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
13 lines |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
14 .filter(|line| !line.is_empty()) |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
15 .map(|line| { |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
16 // Python uses Unicode `str.isalnum` but feature names are all |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
17 // ASCII |
45938
f5d62f4d5327
rhg: check that .hg/requires is ASCII
Simon Sapin <simon-commits@exyr.org>
parents:
45937
diff
changeset
|
18 if line[0].is_ascii_alphanumeric() && line.is_ascii() { |
45924
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
19 Ok(String::from_utf8(line.into()).unwrap()) |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
20 } else { |
46442
02d3bb972121
rust: replace RequirementsError with HgError
Simon Sapin <simon.sapin@octobus.net>
parents:
46167
diff
changeset
|
21 Err(HgError::corrupted("parse error in 'requires' file")) |
45924
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
22 } |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
23 }) |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
24 .collect() |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
25 } |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
26 |
51864 | 27 pub(crate) fn load(hg_vfs: VfsImpl) -> Result<HashSet<String>, HgError> { |
46463
95b276283b67
rhg: add support for share-safe
Simon Sapin <simon.sapin@octobus.net>
parents:
46462
diff
changeset
|
28 parse(&hg_vfs.read("requires")?) |
95b276283b67
rhg: add support for share-safe
Simon Sapin <simon.sapin@octobus.net>
parents:
46462
diff
changeset
|
29 } |
95b276283b67
rhg: add support for share-safe
Simon Sapin <simon.sapin@octobus.net>
parents:
46462
diff
changeset
|
30 |
51864 | 31 pub(crate) fn load_if_exists( |
32 hg_vfs: &VfsImpl, | |
33 ) -> Result<HashSet<String>, HgError> { | |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
34 if let Some(bytes) = hg_vfs.read("requires").io_not_found_as_none()? { |
46442
02d3bb972121
rust: replace RequirementsError with HgError
Simon Sapin <simon.sapin@octobus.net>
parents:
46167
diff
changeset
|
35 parse(&bytes) |
02d3bb972121
rust: replace RequirementsError with HgError
Simon Sapin <simon.sapin@octobus.net>
parents:
46167
diff
changeset
|
36 } else { |
45924
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
37 // Treat a missing file the same as an empty file. |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
38 // From `mercurial/localrepo.py`: |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
39 // > requires file contains a newline-delimited list of |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
40 // > features/capabilities the opener (us) must have in order to use |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
41 // > the repository. This file was introduced in Mercurial 0.9.2, |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
42 // > which means very old repositories may not have one. We assume |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
43 // > a missing file translates to no requirements. |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
44 Ok(HashSet::new()) |
45924
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
45 } |
a2eda1ff22aa
requirements: move loading to hg-core and add parsing
Simon Sapin <simon-commits@exyr.org>
parents:
diff
changeset
|
46 } |
45937
2ad2745e0be9
rhg: exit with relevant code for unsupported requirements
Simon Sapin <simon-commits@exyr.org>
parents:
45924
diff
changeset
|
47 |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
48 pub(crate) fn check(repo: &Repo) -> Result<(), HgError> { |
46614
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
49 let unknown: Vec<_> = repo |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
50 .requirements() |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
51 .iter() |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
52 .map(String::as_str) |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
53 // .filter(|feature| !ALL_SUPPORTED.contains(feature.as_str())) |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
54 .filter(|feature| { |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
55 !REQUIRED.contains(feature) && !SUPPORTED.contains(feature) |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
56 }) |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
57 .collect(); |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
58 if !unknown.is_empty() { |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
59 return Err(HgError::unsupported(format!( |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
60 "repository requires feature unknown to this Mercurial: {}", |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
61 join_display(&unknown, ", ") |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
62 ))); |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
63 } |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
64 let missing: Vec<_> = REQUIRED |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
65 .iter() |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
66 .filter(|&&feature| !repo.requirements().contains(feature)) |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
67 .collect(); |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
68 if !missing.is_empty() { |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
69 return Err(HgError::unsupported(format!( |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
70 "repository is missing feature required by this Mercurial: {}", |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
71 join_display(&missing, ", ") |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
72 ))); |
45937
2ad2745e0be9
rhg: exit with relevant code for unsupported requirements
Simon Sapin <simon-commits@exyr.org>
parents:
45924
diff
changeset
|
73 } |
2ad2745e0be9
rhg: exit with relevant code for unsupported requirements
Simon Sapin <simon-commits@exyr.org>
parents:
45924
diff
changeset
|
74 Ok(()) |
2ad2745e0be9
rhg: exit with relevant code for unsupported requirements
Simon Sapin <simon-commits@exyr.org>
parents:
45924
diff
changeset
|
75 } |
2ad2745e0be9
rhg: exit with relevant code for unsupported requirements
Simon Sapin <simon-commits@exyr.org>
parents:
45924
diff
changeset
|
76 |
46614
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
77 /// rhg does not support repositories that are *missing* any of these features |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
78 const REQUIRED: &[&str] = &["revlogv1", "store", "fncache", "dotencode"]; |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
79 |
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
80 /// rhg supports repository with or without these |
45937
2ad2745e0be9
rhg: exit with relevant code for unsupported requirements
Simon Sapin <simon-commits@exyr.org>
parents:
45924
diff
changeset
|
81 const SUPPORTED: &[&str] = &[ |
51188
13f58ce70299
rust-revlog: teach the revlog opening code to read the repo options
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49500
diff
changeset
|
82 GENERALDELTA_REQUIREMENT, |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
83 SHARED_REQUIREMENT, |
46463
95b276283b67
rhg: add support for share-safe
Simon Sapin <simon.sapin@octobus.net>
parents:
46462
diff
changeset
|
84 SHARESAFE_REQUIREMENT, |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
85 SPARSEREVLOG_REQUIREMENT, |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
86 RELATIVE_SHARED_REQUIREMENT, |
46873
0abf5eba0042
rhg: make rhg recognise it supports zstd compression for revlogs
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
46614
diff
changeset
|
87 REVLOG_COMPRESSION_ZSTD, |
47374
bd88b6bfd8da
rhg: Add support for dirstate-v2
Simon Sapin <simon.sapin@octobus.net>
parents:
47229
diff
changeset
|
88 DIRSTATE_V2_REQUIREMENT, |
49500
3a53871048dc
rhg: fix bugs around [use-dirstate-tracked-hint] and repo auto-upgrade
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
49194
diff
changeset
|
89 DIRSTATE_TRACKED_HINT_V1, |
46090
9eb07ab3f2d4
rhg: use persistent nodemap when available
Simon Sapin <simon-commits@exyr.org>
parents:
45956
diff
changeset
|
90 // As of this writing everything rhg does is read-only. |
9eb07ab3f2d4
rhg: use persistent nodemap when available
Simon Sapin <simon-commits@exyr.org>
parents:
45956
diff
changeset
|
91 // When it starts writing to the repository, it’ll need to either keep the |
9eb07ab3f2d4
rhg: use persistent nodemap when available
Simon Sapin <simon-commits@exyr.org>
parents:
45956
diff
changeset
|
92 // persistent nodemap up to date or remove this entry: |
46614
a069639783a0
rhg: Check .hg/requires for absence of required features
Simon Sapin <simon.sapin@octobus.net>
parents:
46463
diff
changeset
|
93 NODEMAP_REQUIREMENT, |
48409
005ae1a343f8
rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
48295
diff
changeset
|
94 // Not all commands support `sparse` and `narrow`. The commands that do |
005ae1a343f8
rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
48295
diff
changeset
|
95 // not should opt out by checking `has_sparse` and `has_narrow`. |
005ae1a343f8
rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
48295
diff
changeset
|
96 SPARSE_REQUIREMENT, |
005ae1a343f8
rhg: add support for narrow clones and sparse checkouts
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
48295
diff
changeset
|
97 NARROW_REQUIREMENT, |
49061
81d293eb5264
rust-requirements: allow loading repos with `bookmarksinstore` requirement
Martin von Zweigbergk <martinvonz@google.com>
parents:
48409
diff
changeset
|
98 // rhg doesn't care about bookmarks at all yet |
81d293eb5264
rust-requirements: allow loading repos with `bookmarksinstore` requirement
Martin von Zweigbergk <martinvonz@google.com>
parents:
48409
diff
changeset
|
99 BOOKMARKS_IN_STORE_REQUIREMENT, |
45937
2ad2745e0be9
rhg: exit with relevant code for unsupported requirements
Simon Sapin <simon-commits@exyr.org>
parents:
45924
diff
changeset
|
100 ]; |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
101 |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
102 // Copied from mercurial/requirements.py: |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
103 |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
104 pub const DIRSTATE_V2_REQUIREMENT: &str = "dirstate-v2"; |
51188
13f58ce70299
rust-revlog: teach the revlog opening code to read the repo options
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49500
diff
changeset
|
105 pub const GENERALDELTA_REQUIREMENT: &str = "generaldelta"; |
47374
bd88b6bfd8da
rhg: Add support for dirstate-v2
Simon Sapin <simon.sapin@octobus.net>
parents:
47229
diff
changeset
|
106 |
49194
e4b31016e194
auto-upgrade: introduce a way to auto-upgrade to/from tracked-hint
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49191
diff
changeset
|
107 /// A repository that uses the tracked hint dirstate file |
e4b31016e194
auto-upgrade: introduce a way to auto-upgrade to/from tracked-hint
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49191
diff
changeset
|
108 #[allow(unused)] |
e4b31016e194
auto-upgrade: introduce a way to auto-upgrade to/from tracked-hint
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49191
diff
changeset
|
109 pub const DIRSTATE_TRACKED_HINT_V1: &str = "dirstate-tracked-key-v1"; |
e4b31016e194
auto-upgrade: introduce a way to auto-upgrade to/from tracked-hint
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49191
diff
changeset
|
110 |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
111 /// When narrowing is finalized and no longer subject to format changes, |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
112 /// we should move this to just "narrow" or similar. |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
113 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
114 pub const NARROW_REQUIREMENT: &str = "narrowhg-experimental"; |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
115 |
49061
81d293eb5264
rust-requirements: allow loading repos with `bookmarksinstore` requirement
Martin von Zweigbergk <martinvonz@google.com>
parents:
48409
diff
changeset
|
116 /// Bookmarks must be stored in the `store` part of the repository and will be |
81d293eb5264
rust-requirements: allow loading repos with `bookmarksinstore` requirement
Martin von Zweigbergk <martinvonz@google.com>
parents:
48409
diff
changeset
|
117 /// share accross shares |
81d293eb5264
rust-requirements: allow loading repos with `bookmarksinstore` requirement
Martin von Zweigbergk <martinvonz@google.com>
parents:
48409
diff
changeset
|
118 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
119 pub const BOOKMARKS_IN_STORE_REQUIREMENT: &str = "bookmarksinstore"; |
49061
81d293eb5264
rust-requirements: allow loading repos with `bookmarksinstore` requirement
Martin von Zweigbergk <martinvonz@google.com>
parents:
48409
diff
changeset
|
120 |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
121 /// Enables sparse working directory usage |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
122 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
123 pub const SPARSE_REQUIREMENT: &str = "exp-sparse"; |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
124 |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
125 /// Enables the internal phase which is used to hide changesets instead |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
126 /// of stripping them |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
127 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
128 pub const INTERNAL_PHASE_REQUIREMENT: &str = "internal-phase"; |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
129 |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
130 /// Stores manifest in Tree structure |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
131 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
132 pub const TREEMANIFEST_REQUIREMENT: &str = "treemanifest"; |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
133 |
51188
13f58ce70299
rust-revlog: teach the revlog opening code to read the repo options
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49500
diff
changeset
|
134 /// Whether to use the "RevlogNG" or V1 of the revlog format |
13f58ce70299
rust-revlog: teach the revlog opening code to read the repo options
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49500
diff
changeset
|
135 #[allow(unused)] |
13f58ce70299
rust-revlog: teach the revlog opening code to read the repo options
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49500
diff
changeset
|
136 pub const REVLOGV1_REQUIREMENT: &str = "revlogv1"; |
13f58ce70299
rust-revlog: teach the revlog opening code to read the repo options
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49500
diff
changeset
|
137 |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
138 /// Increment the sub-version when the revlog v2 format changes to lock out old |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
139 /// clients. |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
140 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
141 pub const REVLOGV2_REQUIREMENT: &str = "exp-revlogv2.1"; |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
142 |
51188
13f58ce70299
rust-revlog: teach the revlog opening code to read the repo options
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49500
diff
changeset
|
143 /// Increment the sub-version when the revlog v2 format changes to lock out old |
13f58ce70299
rust-revlog: teach the revlog opening code to read the repo options
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49500
diff
changeset
|
144 /// clients. |
13f58ce70299
rust-revlog: teach the revlog opening code to read the repo options
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49500
diff
changeset
|
145 #[allow(unused)] |
13f58ce70299
rust-revlog: teach the revlog opening code to read the repo options
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49500
diff
changeset
|
146 pub const CHANGELOGV2_REQUIREMENT: &str = "exp-changelog-v2"; |
13f58ce70299
rust-revlog: teach the revlog opening code to read the repo options
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49500
diff
changeset
|
147 |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
148 /// A repository with the sparserevlog feature will have delta chains that |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
149 /// can spread over a larger span. Sparse reading cuts these large spans into |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
150 /// pieces, so that each piece isn't too big. |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
151 /// Without the sparserevlog capability, reading from the repository could use |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
152 /// huge amounts of memory, because the whole span would be read at once, |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
153 /// including all the intermediate revisions that aren't pertinent for the |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
154 /// chain. This is why once a repository has enabled sparse-read, it becomes |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
155 /// required. |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
156 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
157 pub const SPARSEREVLOG_REQUIREMENT: &str = "sparserevlog"; |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
158 |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
159 /// A repository with the the copies-sidedata-changeset requirement will store |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
160 /// copies related information in changeset's sidedata. |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
161 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
162 pub const COPIESSDC_REQUIREMENT: &str = "exp-copies-sidedata-changeset"; |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
163 |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
164 /// The repository use persistent nodemap for the changelog and the manifest. |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
165 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
166 pub const NODEMAP_REQUIREMENT: &str = "persistent-nodemap"; |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
167 |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
168 /// Denotes that the current repository is a share |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
169 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
170 pub const SHARED_REQUIREMENT: &str = "shared"; |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
171 |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
172 /// Denotes that current repository is a share and the shared source path is |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
173 /// relative to the current repository root path |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
174 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
175 pub const RELATIVE_SHARED_REQUIREMENT: &str = "relshared"; |
46462
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
176 |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
177 /// A repository with share implemented safely. The repository has different |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
178 /// store and working copy requirements i.e. both `.hg/requires` and |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
179 /// `.hg/store/requires` are present. |
d03b0601e0eb
rhg: initial support for shared repositories
Simon Sapin <simon.sapin@octobus.net>
parents:
46443
diff
changeset
|
180 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
181 pub const SHARESAFE_REQUIREMENT: &str = "share-safe"; |
46873
0abf5eba0042
rhg: make rhg recognise it supports zstd compression for revlogs
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
46614
diff
changeset
|
182 |
0abf5eba0042
rhg: make rhg recognise it supports zstd compression for revlogs
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
46614
diff
changeset
|
183 /// A repository that use zstd compression inside its revlog |
0abf5eba0042
rhg: make rhg recognise it supports zstd compression for revlogs
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
46614
diff
changeset
|
184 #[allow(unused)] |
49191
4450faeb52bb
rust: make requirements public
Rapha?l Gom?s <rgomes@octobus.net>
parents:
49061
diff
changeset
|
185 pub const REVLOG_COMPRESSION_ZSTD: &str = "revlog-compression-zstd"; |