Mercurial > hg
view rust/hg-core/src/operations/debugdata.rs @ 51470:406b413e3cf2 stable
rust-filepatterns: export glob_to_re function
Making this function public should not risk freezing the internal API,
and it can be useful for all downstream code that needs to perform
glob matching against byte strings, such as RHGitaly where it will
be useful to match on branches and tags.
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Mon, 11 Mar 2024 13:23:18 +0100 |
parents | 13f58ce70299 |
children | 69b804c8e09e |
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, RevlogError}; /// Kind of data to debug #[derive(Debug, Copy, Clone, PartialEq, Eq)] 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.store_vfs(), index_file, None, repo.default_revlog_options(kind == DebugDataKind::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()) }