Mercurial > public > mercurial-scm > hg-stable
view rust/hg-core/src/operations/debugdata.rs @ 47992:796206e74b10
rhg: Reuse manifest when checking status of multiple ambiguous files
When `rhg status` cannot determine whether a file is clean based on mtime and
size alone, it needs to compare its contents with those found in the parent
commit. Previously, rhg would find the (same) manifest of that commit again
for every such file. This is lifted out of the loop and reused.
Differential Revision: https://phab.mercurial-scm.org/D11411
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 13 Sep 2021 18:09:10 +0200 |
parents | b274aa2f20fd |
children | f2f57724d4eb |
line wrap: on
line source
// debugdata.rs // // Copyright 2020 Antoine Cezar <antoine.cezar@octobus.net> // // This software may be used and distributed according to the terms of the // GNU General Public License version 2 or any later version. use crate::repo::Repo; use crate::revlog::revlog::{Revlog, RevlogError}; /// Kind of data to debug #[derive(Debug, Copy, Clone)] pub enum DebugDataKind { Changelog, Manifest, } /// Dump the contents data of a revision. pub fn debug_data( repo: &Repo, revset: &str, kind: DebugDataKind, ) -> Result<Vec<u8>, RevlogError> { let index_file = match kind { DebugDataKind::Changelog => "00changelog.i", DebugDataKind::Manifest => "00manifest.i", }; let revlog = Revlog::open(repo, index_file, None)?; let rev = crate::revset::resolve_rev_number_or_hex_prefix(revset, &revlog)?; let data = revlog.get_rev_data(rev)?; Ok(data) }