##// END OF EJS Templates
revlog: update data file record before index rename...
revlog: update data file record before index rename When migrating from inline to non-inline data storage, the data file is recorded initially as zero sized so that it is removed on failure. But the record has to be updated before the index is renamed, otherwise data is lost on rollback. Differential Revision: https://phab.mercurial-scm.org/D10725

File last commit:

r47166:b274aa2f default
r48065:46b828b8 default
Show More
debugdata.rs
33 lines | 911 B | application/rls-services+xml | RustLexer
Antoine Cezar
hg-core: define a `DebugData` `Operation`...
r46098 // 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.
Simon Sapin
rust: introduce Repo and Vfs types for filesystem abstraction...
r46782 use crate::repo::Repo;
Antoine Cezar
hg-core: define a `DebugData` `Operation`...
r46098 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.
Simon Sapin
rust: replace most "operation" structs with functions...
r46751 pub fn debug_data(
Simon Sapin
rust: introduce Repo and Vfs types for filesystem abstraction...
r46782 repo: &Repo,
Simon Sapin
rhg: centralize parsing of `--rev` CLI arguments...
r47162 revset: &str,
Antoine Cezar
hg-core: define a `DebugData` `Operation`...
r46098 kind: DebugDataKind,
Simon Sapin
rust: remove three enums that were identical to `RevlogError`...
r47166 ) -> Result<Vec<u8>, RevlogError> {
Simon Sapin
rust: replace most "operation" structs with functions...
r46751 let index_file = match kind {
Simon Sapin
rust: introduce Repo and Vfs types for filesystem abstraction...
r46782 DebugDataKind::Changelog => "00changelog.i",
DebugDataKind::Manifest => "00manifest.i",
Simon Sapin
rust: replace most "operation" structs with functions...
r46751 };
Simon Sapin
rust: introduce Repo and Vfs types for filesystem abstraction...
r46782 let revlog = Revlog::open(repo, index_file, None)?;
Simon Sapin
rhg: centralize parsing of `--rev` CLI arguments...
r47162 let rev =
crate::revset::resolve_rev_number_or_hex_prefix(revset, &revlog)?;
let data = revlog.get_rev_data(rev)?;
Simon Sapin
rust: replace most "operation" structs with functions...
r46751 Ok(data)
Antoine Cezar
hg-core: define a `DebugData` `Operation`...
r46098 }