Mercurial > public > mercurial-scm > hg-stable
view rust/hg-core/src/operations/debugdata.rs @ 52296:1a8466fd904a
hg-core: add fncache module
For now it's only a super simple trait. It will be used for calling back into
Python soon, and later will be fleshed out into a full fncache.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Mon, 29 Jul 2024 20:28:42 +0200 |
parents | 039b7caeb4d9 |
children | bd8081e9fd62 |
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::errors::HgError; use crate::repo::Repo; use crate::revlog::options::default_revlog_options; use crate::revlog::Revlog; use crate::{exit_codes, RevlogError, RevlogType}; /// Dump the contents data of a revision. pub fn debug_data( repo: &Repo, revset: &str, kind: RevlogType, ) -> Result<Vec<u8>, RevlogError> { let index_file = match kind { RevlogType::Changelog => "00changelog.i", RevlogType::Manifestlog => "00manifest.i", _ => { return Err(RevlogError::Other(HgError::abort( format!("invalid revlog type {}", kind), exit_codes::ABORT, None, ))) } }; let revlog = Revlog::open( &repo.store_vfs(), index_file, None, default_revlog_options( repo.config(), repo.requirements(), RevlogType::Changelog, )?, )?; let rev = crate::revset::resolve_rev_number_or_hex_prefix(revset, &revlog)?; let data = revlog.get_rev_data_for_checked_rev(rev)?; Ok(data.into_owned()) }