Show More
@@ -40,20 +40,16 b" pub fn cat<'a>(" | |||||
40 | files: &'a [HgPathBuf], |
|
40 | files: &'a [HgPathBuf], | |
41 | ) -> Result<CatOutput, RevlogError> { |
|
41 | ) -> Result<CatOutput, RevlogError> { | |
42 | let rev = crate::revset::resolve_single(revset, repo)?; |
|
42 | let rev = crate::revset::resolve_single(revset, repo)?; | |
43 |
let |
|
43 | let manifest = repo.manifest(rev)?; | |
44 | let manifest = repo.manifestlog()?; |
|
44 | let node = *repo | |
45 | let changelog_entry = changelog.get_rev(rev)?; |
|
45 | .changelog()? | |
46 | let node = *changelog |
|
|||
47 | .node_from_rev(rev) |
|
46 | .node_from_rev(rev) | |
48 |
.expect("should succeed when |
|
47 | .expect("should succeed when repo.manifest did"); | |
49 | let manifest_node = |
|
|||
50 | Node::from_hex_for_repo(&changelog_entry.manifest_node()?)?; |
|
|||
51 | let manifest_entry = manifest.get_node(manifest_node.into())?; |
|
|||
52 | let mut bytes = vec![]; |
|
48 | let mut bytes = vec![]; | |
53 | let mut matched = vec![false; files.len()]; |
|
49 | let mut matched = vec![false; files.len()]; | |
54 | let mut found_any = false; |
|
50 | let mut found_any = false; | |
55 |
|
51 | |||
56 |
for (manifest_file, node_bytes) in manifest |
|
52 | for (manifest_file, node_bytes) in manifest.files_with_nodes() { | |
57 | for (cat_file, is_matched) in files.iter().zip(&mut matched) { |
|
53 | for (cat_file, is_matched) in files.iter().zip(&mut matched) { | |
58 | if cat_file.as_bytes() == manifest_file.as_bytes() { |
|
54 | if cat_file.as_bytes() == manifest_file.as_bytes() { | |
59 | *is_matched = true; |
|
55 | *is_matched = true; |
@@ -10,7 +10,6 b' use crate::dirstate_tree::on_disk::{for_' | |||||
10 | use crate::errors::HgError; |
|
10 | use crate::errors::HgError; | |
11 | use crate::repo::Repo; |
|
11 | use crate::repo::Repo; | |
12 | use crate::revlog::manifest::Manifest; |
|
12 | use crate::revlog::manifest::Manifest; | |
13 | use crate::revlog::node::Node; |
|
|||
14 | use crate::revlog::revlog::RevlogError; |
|
13 | use crate::revlog::revlog::RevlogError; | |
15 | use crate::utils::hg_path::HgPath; |
|
14 | use crate::utils::hg_path::HgPath; | |
16 | use crate::DirstateError; |
|
15 | use crate::DirstateError; | |
@@ -71,13 +70,7 b' pub fn list_rev_tracked_files(' | |||||
71 | revset: &str, |
|
70 | revset: &str, | |
72 | ) -> Result<FilesForRev, RevlogError> { |
|
71 | ) -> Result<FilesForRev, RevlogError> { | |
73 | let rev = crate::revset::resolve_single(revset, repo)?; |
|
72 | let rev = crate::revset::resolve_single(revset, repo)?; | |
74 | let changelog = repo.changelog()?; |
|
73 | Ok(FilesForRev(repo.manifest(rev)?)) | |
75 | let manifest = repo.manifestlog()?; |
|
|||
76 | let changelog_entry = changelog.get_rev(rev)?; |
|
|||
77 | let manifest_node = |
|
|||
78 | Node::from_hex_for_repo(&changelog_entry.manifest_node()?)?; |
|
|||
79 | let manifest_entry = manifest.get_node(manifest_node.into())?; |
|
|||
80 | Ok(FilesForRev(manifest_entry)) |
|
|||
81 | } |
|
74 | } | |
82 |
|
75 | |||
83 | pub struct FilesForRev(Manifest); |
|
76 | pub struct FilesForRev(Manifest); |
@@ -5,14 +5,14 b' use crate::dirstate_tree::dirstate_map::' | |||||
5 | use crate::dirstate_tree::owning::OwningDirstateMap; |
|
5 | use crate::dirstate_tree::owning::OwningDirstateMap; | |
6 | use crate::errors::HgError; |
|
6 | use crate::errors::HgError; | |
7 | use crate::errors::HgResultExt; |
|
7 | use crate::errors::HgResultExt; | |
8 | use crate::exit_codes; |
|
8 | use crate::manifest::{Manifest, Manifestlog}; | |
9 | use crate::manifest::Manifestlog; |
|
|||
10 | use crate::requirements; |
|
9 | use crate::requirements; | |
11 | use crate::revlog::revlog::RevlogError; |
|
10 | use crate::revlog::revlog::RevlogError; | |
12 | use crate::utils::files::get_path_from_bytes; |
|
11 | use crate::utils::files::get_path_from_bytes; | |
13 | use crate::utils::SliceExt; |
|
12 | use crate::utils::SliceExt; | |
14 | use crate::vfs::{is_dir, is_file, Vfs}; |
|
13 | use crate::vfs::{is_dir, is_file, Vfs}; | |
15 | use crate::DirstateError; |
|
14 | use crate::{exit_codes, Node}; | |
|
15 | use crate::{DirstateError, Revision}; | |||
16 | use std::cell::{Cell, Ref, RefCell, RefMut}; |
|
16 | use std::cell::{Cell, Ref, RefCell, RefMut}; | |
17 | use std::collections::HashSet; |
|
17 | use std::collections::HashSet; | |
18 | use std::path::{Path, PathBuf}; |
|
18 | use std::path::{Path, PathBuf}; | |
@@ -333,6 +333,19 b' impl Repo {' | |||||
333 | pub fn manifestlog_mut(&self) -> Result<RefMut<Manifestlog>, RevlogError> { |
|
333 | pub fn manifestlog_mut(&self) -> Result<RefMut<Manifestlog>, RevlogError> { | |
334 | self.manifestlog.get_mut_or_init(self) |
|
334 | self.manifestlog.get_mut_or_init(self) | |
335 | } |
|
335 | } | |
|
336 | ||||
|
337 | /// Returns the manifest of the given revision | |||
|
338 | pub fn manifest( | |||
|
339 | &self, | |||
|
340 | revision: Revision, | |||
|
341 | ) -> Result<Manifest, RevlogError> { | |||
|
342 | let changelog = self.changelog()?; | |||
|
343 | let manifest = self.manifestlog()?; | |||
|
344 | let changelog_entry = changelog.get_rev(revision)?; | |||
|
345 | let manifest_node = | |||
|
346 | Node::from_hex_for_repo(&changelog_entry.manifest_node()?)?; | |||
|
347 | manifest.get_node(manifest_node.into()) | |||
|
348 | } | |||
336 | } |
|
349 | } | |
337 |
|
350 | |||
338 | /// Lazily-initialized component of `Repo` with interior mutability |
|
351 | /// Lazily-initialized component of `Repo` with interior mutability |
General Comments 0
You need to be logged in to leave comments.
Login now