Mercurial > public > mercurial-scm > hg-stable
view rust/hg-core/src/operations/debugdata.rs @ 52156:e6a44bc91bc2 stable
rust-update: make `update_from_null` respect `worker.numcpu` config option
This was overlooked in the original series.
This is important for tests (because we run many at once), and for the
occasional end user that wants to keep their CPU usage in check.
A future series should clean up this `worker` parameter tunelling business by
rewriting the config in Rust, but doing so on stable would be a very bad
idea.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Tue, 05 Nov 2024 15:21:09 +0100 |
parents | 69b804c8e09e |
children | 039b7caeb4d9 |
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::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, repo.default_revlog_options(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()) }