comparison rust/hg-core/src/dirstate_tree/dispatch.rs @ 47280:1766130fe9ba

dirstate-v2: Change the on-disk format when the requirement is enabled For now, the format is the same except with an additional marker at the start. This marker is redundant: for existing repositories it is `.hg/requires` that determines which format to use. For new repositories, it is the new `format.exp-dirstate-v2` config. There is no upgrade or downgrade so far. Most of the changes are about plumbing a boolean through layers of APIs to indicate which format should be used. Differential Revision: https://phab.mercurial-scm.org/D10719
author Simon Sapin <simon.sapin@octobus.net>
date Wed, 19 May 2021 13:15:00 +0200
parents cd8ca38fccff
children 4ee9f419c52e
comparison
equal deleted inserted replaced
47279:40b51c28b242 47280:1766130fe9ba
71 fn has_dir( 71 fn has_dir(
72 &mut self, 72 &mut self,
73 directory: &HgPath, 73 directory: &HgPath,
74 ) -> Result<bool, DirstateMapError>; 74 ) -> Result<bool, DirstateMapError>;
75 75
76 fn pack( 76 fn pack_v1(
77 &mut self,
78 parents: DirstateParents,
79 now: Timestamp,
80 ) -> Result<Vec<u8>, DirstateError>;
81
82 fn pack_v2(
77 &mut self, 83 &mut self,
78 parents: DirstateParents, 84 parents: DirstateParents,
79 now: Timestamp, 85 now: Timestamp,
80 ) -> Result<Vec<u8>, DirstateError>; 86 ) -> Result<Vec<u8>, DirstateError>;
81 87
209 directory: &HgPath, 215 directory: &HgPath,
210 ) -> Result<bool, DirstateMapError> { 216 ) -> Result<bool, DirstateMapError> {
211 self.has_dir(directory) 217 self.has_dir(directory)
212 } 218 }
213 219
214 fn pack( 220 fn pack_v1(
215 &mut self, 221 &mut self,
216 parents: DirstateParents, 222 parents: DirstateParents,
217 now: Timestamp, 223 now: Timestamp,
218 ) -> Result<Vec<u8>, DirstateError> { 224 ) -> Result<Vec<u8>, DirstateError> {
219 self.pack(parents, now) 225 self.pack(parents, now)
226 }
227
228 fn pack_v2(
229 &mut self,
230 _parents: DirstateParents,
231 _now: Timestamp,
232 ) -> Result<Vec<u8>, DirstateError> {
233 panic!(
234 "should have used dirstate_tree::DirstateMap to use the v2 format"
235 )
220 } 236 }
221 237
222 fn set_all_dirs(&mut self) -> Result<(), DirstateMapError> { 238 fn set_all_dirs(&mut self) -> Result<(), DirstateMapError> {
223 self.set_all_dirs() 239 self.set_all_dirs()
224 } 240 }