##// END OF EJS Templates
tracked-key: remove the dual write and rename to tracked-hint...
tracked-key: remove the dual write and rename to tracked-hint The dual-write approach was mostly useless. As explained in the previous version of the help, the key had to be read twice before we could cache a value. However this "read twice" limitation actually also apply to any usage of the key. If some operation wants to rely of the "same value == same tracked set" property it would need to read the value before, and after running that operation (or at least, after, in all cases). So it cannot be sure the operation it did is "valid" until checking the key after the operation. As a resultat such operation can only be read-only or rollbackable. This reduce the utility of the "same value == same tracked set" a lot. So it seems simpler to drop the double write and to update the documentation to highlight that this file does not garantee race-free operation. As a result the "key" is demoted to a "hint". Documentation is updated accordingly. Differential Revision: https://phab.mercurial-scm.org/D12201

File last commit:

r49373:f2f57724 default
r49644:6e559391 default
Show More
debugdata.rs
33 lines | 924 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
rhg: Add RevlogEntry::data that does delta resolution...
r49373 Ok(data.into_owned())
Antoine Cezar
hg-core: define a `DebugData` `Operation`...
r46098 }