##// END OF EJS Templates
rust-dirstate: rename `has_dirstate_v2` to `use_dirstate_v2`...
Raphaël Gomès -
r51551:1e2c6cda stable
parent child Browse files
Show More
@@ -232,7 +232,16 b' impl Repo {'
232 232 try_with_lock_no_wait(self.hg_vfs(), "wlock", f)
233 233 }
234 234
235 pub fn has_dirstate_v2(&self) -> bool {
235 /// Whether this repo should use dirstate-v2.
236 /// The presence of `dirstate-v2` in the requirements does not mean that
237 /// the on-disk dirstate is necessarily in version 2. In most cases,
238 /// a dirstate-v2 file will indeed be found, but in rare cases (like the
239 /// upgrade mechanism being cut short), the on-disk version will be a
240 /// v1 file.
241 /// Semantically, having a requirement only means that a client should be
242 /// able to understand the repo *if* it uses the requirement, but not that
243 /// the requirement is actually used.
244 pub fn use_dirstate_v2(&self) -> bool {
236 245 self.requirements
237 246 .contains(requirements::DIRSTATE_V2_REQUIREMENT)
238 247 }
@@ -277,7 +286,7 b' impl Repo {'
277 286 let dirstate = self.dirstate_file_contents()?;
278 287 let parents = if dirstate.is_empty() {
279 288 DirstateParents::NULL
280 } else if self.has_dirstate_v2() {
289 } else if self.use_dirstate_v2() {
281 290 let docket =
282 291 crate::dirstate_tree::on_disk::read_docket(&dirstate)?;
283 292 docket.parents()
@@ -296,7 +305,7 b' impl Repo {'
296 305 &self,
297 306 ) -> Result<DirstateMapIdentity, HgError> {
298 307 assert!(
299 self.has_dirstate_v2(),
308 self.use_dirstate_v2(),
300 309 "accessing dirstate data file ID without dirstate-v2"
301 310 );
302 311 // Get the identity before the contents since we could have a race
@@ -316,7 +325,7 b' impl Repo {'
316 325 }
317 326
318 327 fn new_dirstate_map(&self) -> Result<OwningDirstateMap, DirstateError> {
319 if self.has_dirstate_v2() {
328 if self.use_dirstate_v2() {
320 329 // The v2 dirstate is split into a docket and a data file.
321 330 // Since we don't always take the `wlock` to read it
322 331 // (like in `hg status`), it is susceptible to races.
@@ -550,7 +559,7 b' impl Repo {'
550 559 // TODO: Maintain a `DirstateMap::dirty` flag, and return early here if
551 560 // it’s unset
552 561 let parents = self.dirstate_parents()?;
553 let (packed_dirstate, old_uuid_to_remove) = if self.has_dirstate_v2() {
562 let (packed_dirstate, old_uuid_to_remove) = if self.use_dirstate_v2() {
554 563 let (identity, uuid, data_size) =
555 564 self.get_dirstate_data_file_integrity()?;
556 565 let identity_changed = identity != map.old_identity();
General Comments 0
You need to be logged in to leave comments. Login now