Show More
@@ -187,8 +187,8 b' impl Repo {' | |||||
187 | Self::read_dirstate_data_file_uuid, |
|
187 | Self::read_dirstate_data_file_uuid, | |
188 | ), |
|
188 | ), | |
189 | dirstate_map: LazyCell::new(Self::new_dirstate_map), |
|
189 | dirstate_map: LazyCell::new(Self::new_dirstate_map), | |
190 |
changelog: LazyCell::new( |
|
190 | changelog: LazyCell::new(Self::new_changelog), | |
191 |
manifestlog: LazyCell::new( |
|
191 | manifestlog: LazyCell::new(Self::new_manifestlog), | |
192 | }; |
|
192 | }; | |
193 |
|
193 | |||
194 | requirements::check(&repo)?; |
|
194 | requirements::check(&repo)?; | |
@@ -344,6 +344,13 b' impl Repo {' | |||||
344 | self.dirstate_map.get_mut_or_init(self) |
|
344 | self.dirstate_map.get_mut_or_init(self) | |
345 | } |
|
345 | } | |
346 |
|
346 | |||
|
347 | fn new_changelog(&self) -> Result<Changelog, HgError> { | |||
|
348 | let use_nodemap = self | |||
|
349 | .requirements | |||
|
350 | .contains(requirements::NODEMAP_REQUIREMENT); | |||
|
351 | Changelog::open(&self.store_vfs(), use_nodemap) | |||
|
352 | } | |||
|
353 | ||||
347 | pub fn changelog(&self) -> Result<Ref<Changelog>, HgError> { |
|
354 | pub fn changelog(&self) -> Result<Ref<Changelog>, HgError> { | |
348 | self.changelog.get_or_init(self) |
|
355 | self.changelog.get_or_init(self) | |
349 | } |
|
356 | } | |
@@ -352,6 +359,13 b' impl Repo {' | |||||
352 | self.changelog.get_mut_or_init(self) |
|
359 | self.changelog.get_mut_or_init(self) | |
353 | } |
|
360 | } | |
354 |
|
361 | |||
|
362 | fn new_manifestlog(&self) -> Result<Manifestlog, HgError> { | |||
|
363 | let use_nodemap = self | |||
|
364 | .requirements | |||
|
365 | .contains(requirements::NODEMAP_REQUIREMENT); | |||
|
366 | Manifestlog::open(&self.store_vfs(), use_nodemap) | |||
|
367 | } | |||
|
368 | ||||
355 | pub fn manifestlog(&self) -> Result<Ref<Manifestlog>, HgError> { |
|
369 | pub fn manifestlog(&self) -> Result<Ref<Manifestlog>, HgError> { | |
356 | self.manifestlog.get_or_init(self) |
|
370 | self.manifestlog.get_or_init(self) | |
357 | } |
|
371 | } |
@@ -1,10 +1,9 b'' | |||||
1 | use crate::errors::HgError; |
|
1 | use crate::errors::HgError; | |
2 | use crate::repo::Repo; |
|
|||
3 | use crate::requirements; |
|
|||
4 | use crate::revlog::revlog::{Revlog, RevlogEntry, RevlogError}; |
|
2 | use crate::revlog::revlog::{Revlog, RevlogEntry, RevlogError}; | |
5 | use crate::revlog::Revision; |
|
3 | use crate::revlog::Revision; | |
6 | use crate::revlog::{Node, NodePrefix}; |
|
4 | use crate::revlog::{Node, NodePrefix}; | |
7 | use crate::utils::hg_path::HgPath; |
|
5 | use crate::utils::hg_path::HgPath; | |
|
6 | use crate::vfs::Vfs; | |||
8 | use itertools::Itertools; |
|
7 | use itertools::Itertools; | |
9 | use std::ascii::escape_default; |
|
8 | use std::ascii::escape_default; | |
10 | use std::fmt::{Debug, Formatter}; |
|
9 | use std::fmt::{Debug, Formatter}; | |
@@ -17,16 +16,9 b' pub struct Changelog {' | |||||
17 |
|
16 | |||
18 | impl Changelog { |
|
17 | impl Changelog { | |
19 | /// Open the `changelog` of a repository given by its root. |
|
18 | /// Open the `changelog` of a repository given by its root. | |
20 |
pub fn open( |
|
19 | pub fn open(store_vfs: &Vfs, use_nodemap: bool) -> Result<Self, HgError> { | |
21 |
let |
|
20 | let revlog = | |
22 | .requirements() |
|
21 | Revlog::open(store_vfs, "00changelog.i", None, use_nodemap)?; | |
23 | .contains(requirements::NODEMAP_REQUIREMENT); |
|
|||
24 | let revlog = Revlog::open( |
|
|||
25 | &repo.store_vfs(), |
|
|||
26 | "00changelog.i", |
|
|||
27 | None, |
|
|||
28 | use_nodemap, |
|
|||
29 | )?; |
|
|||
30 | Ok(Self { revlog }) |
|
22 | Ok(Self { revlog }) | |
31 | } |
|
23 | } | |
32 |
|
24 |
@@ -1,11 +1,10 b'' | |||||
1 | use crate::errors::HgError; |
|
1 | use crate::errors::HgError; | |
2 | use crate::repo::Repo; |
|
|||
3 | use crate::requirements; |
|
|||
4 | use crate::revlog::revlog::{Revlog, RevlogError}; |
|
2 | use crate::revlog::revlog::{Revlog, RevlogError}; | |
5 | use crate::revlog::Revision; |
|
3 | use crate::revlog::Revision; | |
6 | use crate::revlog::{Node, NodePrefix}; |
|
4 | use crate::revlog::{Node, NodePrefix}; | |
7 | use crate::utils::hg_path::HgPath; |
|
5 | use crate::utils::hg_path::HgPath; | |
8 | use crate::utils::SliceExt; |
|
6 | use crate::utils::SliceExt; | |
|
7 | use crate::vfs::Vfs; | |||
9 |
|
8 | |||
10 | /// A specialized `Revlog` to work with `manifest` data format. |
|
9 | /// A specialized `Revlog` to work with `manifest` data format. | |
11 | pub struct Manifestlog { |
|
10 | pub struct Manifestlog { | |
@@ -15,16 +14,9 b' pub struct Manifestlog {' | |||||
15 |
|
14 | |||
16 | impl Manifestlog { |
|
15 | impl Manifestlog { | |
17 | /// Open the `manifest` of a repository given by its root. |
|
16 | /// Open the `manifest` of a repository given by its root. | |
18 |
pub fn open( |
|
17 | pub fn open(store_vfs: &Vfs, use_nodemap: bool) -> Result<Self, HgError> { | |
19 |
let |
|
18 | let revlog = | |
20 | .requirements() |
|
19 | Revlog::open(store_vfs, "00manifest.i", None, use_nodemap)?; | |
21 | .contains(requirements::NODEMAP_REQUIREMENT); |
|
|||
22 | let revlog = Revlog::open( |
|
|||
23 | &repo.store_vfs(), |
|
|||
24 | "00manifest.i", |
|
|||
25 | None, |
|
|||
26 | use_nodemap, |
|
|||
27 | )?; |
|
|||
28 | Ok(Self { revlog }) |
|
20 | Ok(Self { revlog }) | |
29 | } |
|
21 | } | |
30 |
|
22 |
General Comments 0
You need to be logged in to leave comments.
Login now