##// END OF EJS Templates
revlog: make `clearcaches()` signature consistent with ManifestRevlog...
revlog: make `clearcaches()` signature consistent with ManifestRevlog I'm not sure if this a newly added bug, because of using a different version of pytype, or if the recent work around avoiding the zope interface types in the type checking phase (see 5eb98ea78fd7 and friends)... but pytype 2023.11.21 started flagging this series since it was last pushed ~6 weeks ago: File "/mnt/c/Users/Matt/hg/mercurial/bundlerepo.py", line 204, in <module>: Overriding method signature mismatch [signature-mismatch] Base signature: 'def mercurial.manifest.ManifestRevlog.clearcaches(self, clear_persisted_data: Any = ...) -> None'. Subclass signature: 'def mercurial.revlog.revlog.clearcaches(self) -> None'. Not enough positional parameters in overriding method. Maybe the multiple inheritance in `bundlerepo.bundlemanifest` is bad, but it seems like a `ManifestRevlog` is-a `revlog`, even though the class hierarchy isn't coded that way. Additionally, it looks like `revlog.clearcaches()` is dealing with some persistent data, so maybe this is useful to have there anyway. Also sprinkle some trivial type hints on the method, because there are other `clearcaches()` definitions in the codebase with these hints, and I don't feel like waiting for another pytype run to see if it cares that specifically about the signature matching.

File last commit:

r52760:69b804c8 default
r52765:5e79783d default
Show More
debugdata.rs
40 lines | 1.2 KiB | 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.
Raphaël Gomès
rust: use new revlog configs in all revlog opening code...
r52760 use crate::errors::HgError;
Simon Sapin
rust: introduce Repo and Vfs types for filesystem abstraction...
r46782 use crate::repo::Repo;
Raphaël Gomès
rust: use new revlog configs in all revlog opening code...
r52760 use crate::revlog::Revlog;
use crate::{exit_codes, RevlogError, RevlogType};
Antoine Cezar
hg-core: define a `DebugData` `Operation`...
r46098
/// 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,
Raphaël Gomès
rust: use new revlog configs in all revlog opening code...
r52760 kind: RevlogType,
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 {
Raphaël Gomès
rust: use new revlog configs in all revlog opening code...
r52760 RevlogType::Changelog => "00changelog.i",
RevlogType::Manifestlog => "00manifest.i",
_ => {
return Err(RevlogError::Other(HgError::abort(
format!("invalid revlog type {}", kind),
exit_codes::ABORT,
None,
)))
}
Simon Sapin
rust: replace most "operation" structs with functions...
r46751 };
Raphaël Gomès
rust-revlog: teach the revlog opening code to read the repo options...
r52084 let revlog = Revlog::open(
&repo.store_vfs(),
index_file,
None,
Raphaël Gomès
rust: use new revlog configs in all revlog opening code...
r52760 repo.default_revlog_options(RevlogType::Changelog)?,
Raphaël Gomès
rust-revlog: teach the revlog opening code to read the repo options...
r52084 )?;
Simon Sapin
rhg: centralize parsing of `--rev` CLI arguments...
r47162 let rev =
crate::revset::resolve_rev_number_or_hex_prefix(revset, &revlog)?;
Raphaël Gomès
rust: use the new `UncheckedRevision` everywhere applicable...
r51870 let data = revlog.get_rev_data_for_checked_rev(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 }