##// END OF EJS Templates
graft: gather arg compatibility code...
graft: gather arg compatibility code Lets do it all in one place and at the start, this is easier to maintain consistently. We also take this as an opportunity to do this before we resolve commit options, that so user do not get error about "--date" when they actually they specified the "--current-date" argument.

File last commit:

r53187:a3fa37bd default
r53233:8faabe8a default
Show More
debugdata.rs
45 lines | 1.3 KiB | application/rls-services+xml | RustLexer
// 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::exit_codes;
use crate::repo::Repo;
use crate::revlog::options::default_revlog_options;
use crate::revlog::{Revlog, 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_data(rev)?;
Ok(data.into_owned())
}