##// END OF EJS Templates
rust-revlog: make unaware of `Repo`...
Martin von Zweigbergk -
r49980:399439c1 default
parent child Browse files
Show More
@@ -29,7 +29,8 b' pub fn debug_data('
29 29 let use_nodemap = repo
30 30 .requirements()
31 31 .contains(requirements::NODEMAP_REQUIREMENT);
32 let revlog = Revlog::open(repo, index_file, None, use_nodemap)?;
32 let revlog =
33 Revlog::open(&repo.store_vfs(), index_file, None, use_nodemap)?;
33 34 let rev =
34 35 crate::revset::resolve_rev_number_or_hex_prefix(revset, &revlog)?;
35 36 let data = revlog.get_rev_data(rev)?;
@@ -21,7 +21,12 b' impl Changelog {'
21 21 let use_nodemap = repo
22 22 .requirements()
23 23 .contains(requirements::NODEMAP_REQUIREMENT);
24 let revlog = Revlog::open(repo, "00changelog.i", None, use_nodemap)?;
24 let revlog = Revlog::open(
25 &repo.store_vfs(),
26 "00changelog.i",
27 None,
28 use_nodemap,
29 )?;
25 30 Ok(Self { revlog })
26 31 }
27 32
@@ -20,7 +20,12 b' impl Filelog {'
20 20 pub fn open(repo: &Repo, file_path: &HgPath) -> Result<Self, HgError> {
21 21 let index_path = store_path(file_path, b".i");
22 22 let data_path = store_path(file_path, b".d");
23 let revlog = Revlog::open(repo, index_path, Some(&data_path), false)?;
23 let revlog = Revlog::open(
24 &repo.store_vfs(),
25 index_path,
26 Some(&data_path),
27 false,
28 )?;
24 29 Ok(Self { revlog })
25 30 }
26 31
@@ -19,7 +19,12 b' impl Manifestlog {'
19 19 let use_nodemap = repo
20 20 .requirements()
21 21 .contains(requirements::NODEMAP_REQUIREMENT);
22 let revlog = Revlog::open(repo, "00manifest.i", None, use_nodemap)?;
22 let revlog = Revlog::open(
23 &repo.store_vfs(),
24 "00manifest.i",
25 None,
26 use_nodemap,
27 )?;
23 28 Ok(Self { revlog })
24 29 }
25 30
@@ -16,8 +16,8 b' use super::nodemap::{NodeMap, NodeMapErr'
16 16 use super::nodemap_docket::NodeMapDocket;
17 17 use super::patch;
18 18 use crate::errors::HgError;
19 use crate::repo::Repo;
20 19 use crate::revlog::Revision;
20 use crate::vfs::Vfs;
21 21 use crate::{Node, NULL_REVISION};
22 22
23 23 const REVISION_FLAG_CENSORED: u16 = 1 << 15;
@@ -81,14 +81,14 b' impl Revlog {'
81 81 /// interleaved.
82 82 #[timed]
83 83 pub fn open(
84 repo: &Repo,
84 store_vfs: &Vfs,
85 85 index_path: impl AsRef<Path>,
86 86 data_path: Option<&Path>,
87 87 use_nodemap: bool,
88 88 ) -> Result<Self, HgError> {
89 89 let index_path = index_path.as_ref();
90 90 let index = {
91 match repo.store_vfs().mmap_open_opt(&index_path)? {
91 match store_vfs.mmap_open_opt(&index_path)? {
92 92 None => Index::new(Box::new(vec![])),
93 93 Some(index_mmap) => {
94 94 let index = Index::new(Box::new(index_mmap))?;
@@ -106,7 +106,7 b' impl Revlog {'
106 106 None
107 107 } else {
108 108 let data_path = data_path.unwrap_or(&default_data_path);
109 let data_mmap = repo.store_vfs().mmap_open(data_path)?;
109 let data_mmap = store_vfs.mmap_open(data_path)?;
110 110 Some(Box::new(data_mmap))
111 111 };
112 112
@@ -115,7 +115,7 b' impl Revlog {'
115 115 } else if !use_nodemap {
116 116 None
117 117 } else {
118 NodeMapDocket::read_from_file(&repo.store_vfs(), index_path)?.map(
118 NodeMapDocket::read_from_file(store_vfs, index_path)?.map(
119 119 |(docket, data)| {
120 120 nodemap::NodeTree::load_bytes(
121 121 Box::new(data),
General Comments 0
You need to be logged in to leave comments. Login now