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