##// END OF EJS Templates
tracked-key: update the requirement value...
marmoute -
r49642:1af95465 default
parent child Browse files
Show More
@@ -1,121 +1,121 b''
1 1 # requirements.py - objects and functions related to repository requirements
2 2 #
3 3 # Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 # obsolete experimental requirements:
11 11 # - manifestv2: An experimental new manifest format that allowed
12 12 # for stem compression of long paths. Experiment ended up not
13 13 # being successful (repository sizes went up due to worse delta
14 14 # chains), and the code was deleted in 4.6.
15 15
16 16 GENERALDELTA_REQUIREMENT = b'generaldelta'
17 17 DOTENCODE_REQUIREMENT = b'dotencode'
18 18 STORE_REQUIREMENT = b'store'
19 19 FNCACHE_REQUIREMENT = b'fncache'
20 20
21 DIRSTATE_TRACKED_KEY_V1 = b'exp-dirstate-tracked-key-v1'
21 DIRSTATE_TRACKED_KEY_V1 = b'dirstate-tracked-key-v1'
22 22 DIRSTATE_V2_REQUIREMENT = b'dirstate-v2'
23 23
24 24 # When narrowing is finalized and no longer subject to format changes,
25 25 # we should move this to just "narrow" or similar.
26 26 NARROW_REQUIREMENT = b'narrowhg-experimental'
27 27
28 28 # Enables sparse working directory usage
29 29 SPARSE_REQUIREMENT = b'exp-sparse'
30 30
31 31 # Enables the internal phase which is used to hide changesets instead
32 32 # of stripping them
33 33 INTERNAL_PHASE_REQUIREMENT = b'internal-phase'
34 34
35 35 # Stores manifest in Tree structure
36 36 TREEMANIFEST_REQUIREMENT = b'treemanifest'
37 37
38 38 REVLOGV1_REQUIREMENT = b'revlogv1'
39 39
40 40 # allow using ZSTD as compression engine for revlog content
41 41 REVLOG_COMPRESSION_ZSTD = b'revlog-compression-zstd'
42 42
43 43 # Increment the sub-version when the revlog v2 format changes to lock out old
44 44 # clients.
45 45 CHANGELOGV2_REQUIREMENT = b'exp-changelog-v2'
46 46
47 47 # Increment the sub-version when the revlog v2 format changes to lock out old
48 48 # clients.
49 49 REVLOGV2_REQUIREMENT = b'exp-revlogv2.2'
50 50
51 51 # A repository with the sparserevlog feature will have delta chains that
52 52 # can spread over a larger span. Sparse reading cuts these large spans into
53 53 # pieces, so that each piece isn't too big.
54 54 # Without the sparserevlog capability, reading from the repository could use
55 55 # huge amounts of memory, because the whole span would be read at once,
56 56 # including all the intermediate revisions that aren't pertinent for the chain.
57 57 # This is why once a repository has enabled sparse-read, it becomes required.
58 58 SPARSEREVLOG_REQUIREMENT = b'sparserevlog'
59 59
60 60 # A repository with the the copies-sidedata-changeset requirement will store
61 61 # copies related information in changeset's sidedata.
62 62 COPIESSDC_REQUIREMENT = b'exp-copies-sidedata-changeset'
63 63
64 64 # The repository use persistent nodemap for the changelog and the manifest.
65 65 NODEMAP_REQUIREMENT = b'persistent-nodemap'
66 66
67 67 # Denotes that the current repository is a share
68 68 SHARED_REQUIREMENT = b'shared'
69 69
70 70 # Denotes that current repository is a share and the shared source path is
71 71 # relative to the current repository root path
72 72 RELATIVE_SHARED_REQUIREMENT = b'relshared'
73 73
74 74 # A repository with share implemented safely. The repository has different
75 75 # store and working copy requirements i.e. both `.hg/requires` and
76 76 # `.hg/store/requires` are present.
77 77 SHARESAFE_REQUIREMENT = b'share-safe'
78 78
79 79 # Bookmarks must be stored in the `store` part of the repository and will be
80 80 # share accross shares
81 81 BOOKMARKS_IN_STORE_REQUIREMENT = b'bookmarksinstore'
82 82
83 83 # List of requirements which are working directory specific
84 84 # These requirements cannot be shared between repositories if they
85 85 # share the same store
86 86 # * sparse is a working directory specific functionality and hence working
87 87 # directory specific requirement
88 88 # * SHARED_REQUIREMENT and RELATIVE_SHARED_REQUIREMENT are requirements which
89 89 # represents that the current working copy/repository shares store of another
90 90 # repo. Hence both of them should be stored in working copy
91 91 # * SHARESAFE_REQUIREMENT needs to be stored in working dir to mark that rest of
92 92 # the requirements are stored in store's requires
93 93 # * DIRSTATE_V2_REQUIREMENT affects .hg/dirstate, of which there is one per
94 94 # working directory.
95 95 WORKING_DIR_REQUIREMENTS = {
96 96 SPARSE_REQUIREMENT,
97 97 SHARED_REQUIREMENT,
98 98 RELATIVE_SHARED_REQUIREMENT,
99 99 SHARESAFE_REQUIREMENT,
100 100 DIRSTATE_TRACKED_KEY_V1,
101 101 DIRSTATE_V2_REQUIREMENT,
102 102 }
103 103
104 104 # List of requirement that impact "stream-clone" (and hardlink clone) and
105 105 # cannot be changed in such cases.
106 106 #
107 107 # requirements not in this list are safe to be altered during stream-clone.
108 108 #
109 109 # note: the list is currently inherited from previous code and miss some relevant requirement while containing some irrelevant ones.
110 110 STREAM_FIXED_REQUIREMENTS = {
111 111 BOOKMARKS_IN_STORE_REQUIREMENT,
112 112 CHANGELOGV2_REQUIREMENT,
113 113 COPIESSDC_REQUIREMENT,
114 114 GENERALDELTA_REQUIREMENT,
115 115 INTERNAL_PHASE_REQUIREMENT,
116 116 REVLOG_COMPRESSION_ZSTD,
117 117 REVLOGV1_REQUIREMENT,
118 118 REVLOGV2_REQUIREMENT,
119 119 SPARSEREVLOG_REQUIREMENT,
120 120 TREEMANIFEST_REQUIREMENT,
121 121 }
@@ -1,204 +1,204 b''
1 1 ==============================
2 2 Test the "tracked key" feature
3 3 ==============================
4 4
5 5 The tracked key feature provide a file that get updated when the set of tracked
6 6 files get updated.
7 7
8 8 basic setup
9 9
10 10 $ cat << EOF >> $HGRCPATH
11 11 > [format]
12 12 > dirstate-tracked-key=yes
13 13 > EOF
14 14
15 15 $ hg init tracked-key-test
16 16 $ cd tracked-key-test
17 17 $ hg debugbuilddag '.+10' -n
18 18 $ hg log -G -T '{rev} {desc} {files}\n'
19 19 o 10 r10 nf10
20 20 |
21 21 o 9 r9 nf9
22 22 |
23 23 o 8 r8 nf8
24 24 |
25 25 o 7 r7 nf7
26 26 |
27 27 o 6 r6 nf6
28 28 |
29 29 o 5 r5 nf5
30 30 |
31 31 o 4 r4 nf4
32 32 |
33 33 o 3 r3 nf3
34 34 |
35 35 o 2 r2 nf2
36 36 |
37 37 o 1 r1 nf1
38 38 |
39 39 o 0 r0 nf0
40 40
41 41 $ hg up tip
42 42 11 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 43 $ hg files
44 44 nf0
45 45 nf1
46 46 nf10
47 47 nf2
48 48 nf3
49 49 nf4
50 50 nf5
51 51 nf6
52 52 nf7
53 53 nf8
54 54 nf9
55 55
56 56 key-file exists
57 57 -----------
58 58
59 59 The tracked key file should exist
60 60
61 61 $ ls -1 .hg/dirstate*
62 62 .hg/dirstate
63 63 .hg/dirstate-tracked-key
64 64
65 65 key-file stay the same if the tracked set is unchanged
66 66 ------------------------------------------------------
67 67
68 68 (copy its content for later comparison)
69 69
70 70 $ cp .hg/dirstate-tracked-key ../key-bck
71 71 $ echo foo >> nf0
72 72 $ sleep 1
73 73 $ hg status
74 74 M nf0
75 75 $ diff --brief .hg/dirstate-tracked-key ../key-bck
76 76 $ hg revert -C nf0
77 77 $ sleep 1
78 78 $ hg status
79 79 $ diff --brief .hg/dirstate-tracked-key ../key-bck
80 80
81 81 key-file change if the tracked set is changed manually
82 82 ------------------------------------------------------
83 83
84 84 adding a file to tracking
85 85
86 86 $ cp .hg/dirstate-tracked-key ../key-bck
87 87 $ echo x > x
88 88 $ hg add x
89 89 $ diff --brief .hg/dirstate-tracked-key ../key-bck
90 90 Files .hg/dirstate-tracked-key and ../key-bck differ
91 91 [1]
92 92
93 93 remove a file from tracking
94 94 (forget)
95 95
96 96 $ cp .hg/dirstate-tracked-key ../key-bck
97 97 $ hg forget x
98 98 $ diff --brief .hg/dirstate-tracked-key ../key-bck
99 99 Files .hg/dirstate-tracked-key and ../key-bck differ
100 100 [1]
101 101
102 102 (remove)
103 103
104 104 $ cp .hg/dirstate-tracked-key ../key-bck
105 105 $ hg remove nf1
106 106 $ diff --brief .hg/dirstate-tracked-key ../key-bck
107 107 Files .hg/dirstate-tracked-key and ../key-bck differ
108 108 [1]
109 109
110 110 key-file changes on revert (when applicable)
111 111 --------------------------------------------
112 112
113 113 $ cp .hg/dirstate-tracked-key ../key-bck
114 114 $ hg status
115 115 R nf1
116 116 ? x
117 117 $ hg revert --all
118 118 undeleting nf1
119 119 $ hg status
120 120 ? x
121 121 $ diff --brief .hg/dirstate-tracked-key ../key-bck
122 122 Files .hg/dirstate-tracked-key and ../key-bck differ
123 123 [1]
124 124
125 125
126 126 `hg update` does affect the key-file (when needed)
127 127 --------------------------------------------------
128 128
129 129 update changing the tracked set
130 130
131 131 (removing)
132 132
133 133 $ cp .hg/dirstate-tracked-key ../key-bck
134 134 $ hg status --rev . --rev '.#generations[-1]'
135 135 R nf10
136 136 $ hg up '.#generations[-1]'
137 137 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
138 138 $ diff --brief .hg/dirstate-tracked-key ../key-bck
139 139 Files .hg/dirstate-tracked-key and ../key-bck differ
140 140 [1]
141 141
142 142 (adding)
143 143
144 144 $ cp .hg/dirstate-tracked-key ../key-bck
145 145 $ hg status --rev . --rev '.#generations[1]'
146 146 A nf10
147 147 $ hg up '.#generations[1]'
148 148 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 149 $ diff --brief .hg/dirstate-tracked-key ../key-bck
150 150 Files .hg/dirstate-tracked-key and ../key-bck differ
151 151 [1]
152 152
153 153 update not affecting the tracked set
154 154
155 155 $ echo foo >> nf0
156 156 $ hg commit -m foo
157 157
158 158 $ cp .hg/dirstate-tracked-key ../key-bck
159 159 $ hg status --rev . --rev '.#generations[-1]'
160 160 M nf0
161 161 $ hg up '.#generations[-1]'
162 162 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
163 163 $ diff --brief .hg/dirstate-tracked-key ../key-bck
164 164
165 165 Test upgrade and downgrade
166 166 ==========================
167 167
168 168 $ ls .hg/dirstate-tracked-key
169 169 .hg/dirstate-tracked-key
170 170 $ hg debugrequires | grep 'tracked'
171 exp-dirstate-tracked-key-v1
171 dirstate-tracked-key-v1
172 172
173 173 downgrade
174 174
175 175 $ hg debugupgraderepo --config format.dirstate-tracked-key=no --run --quiet
176 176 upgrade will perform the following actions:
177 177
178 178 requirements
179 179 preserved: * (glob)
180 removed: exp-dirstate-tracked-key-v1
180 removed: dirstate-tracked-key-v1
181 181
182 182 no revlogs to process
183 183
184 184 $ ls -1 .hg/dirstate-tracked-key
185 185 ls: cannot access '.hg/dirstate-tracked-key': $ENOENT$
186 186 [2]
187 187 $ hg debugrequires | grep 'tracked'
188 188 [1]
189 189
190 190 upgrade
191 191
192 192 $ hg debugupgraderepo --config format.dirstate-tracked-key=yes --run --quiet
193 193 upgrade will perform the following actions:
194 194
195 195 requirements
196 196 preserved: * (glob)
197 added: exp-dirstate-tracked-key-v1
197 added: dirstate-tracked-key-v1
198 198
199 199 no revlogs to process
200 200
201 201 $ ls -1 .hg/dirstate-tracked-key
202 202 .hg/dirstate-tracked-key
203 203 $ hg debugrequires | grep 'tracked'
204 exp-dirstate-tracked-key-v1
204 dirstate-tracked-key-v1
General Comments 0
You need to be logged in to leave comments. Login now