# HG changeset patch # User Georges Racinet # Date 2023-03-30 10:21:38 # Node ID 071a6c1d291e59f4830564ab53258e94944c2638 # Parent c101e7757ed77f989457f5869bd5ead8d566a736 rust-changelog: introduce ChangelogEntry parent entries accessors Straightforwards now that lifetimes are explicit in `RevlogEntry` parent accessors. diff --git a/rust/hg-core/src/revlog/changelog.rs b/rust/hg-core/src/revlog/changelog.rs --- a/rust/hg-core/src/revlog/changelog.rs +++ b/rust/hg-core/src/revlog/changelog.rs @@ -106,6 +106,20 @@ impl<'changelog> ChangelogEntry<'changel pub fn as_revlog_entry(&self) -> &RevlogEntry { &self.revlog_entry } + + pub fn p1_entry(&self) -> Result, RevlogError> { + Ok(self + .revlog_entry + .p1_entry()? + .map(|revlog_entry| Self { revlog_entry })) + } + + pub fn p2_entry(&self) -> Result, RevlogError> { + Ok(self + .revlog_entry + .p2_entry()? + .map(|revlog_entry| Self { revlog_entry })) + } } /// `Changelog` entry which knows how to interpret the `changelog` data bytes.