Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/revlog/changelog.rs @ 46744:b1f2c2b336ec
rhg: `cat` command: print error messages for missing files
And exit with an error code if no file was matched.
This matches the behavior of Python-based hg.
Differential Revision: https://phab.mercurial-scm.org/D10142
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 03 Mar 2021 16:40:03 +0100 |
parents | 43d63979a75e |
children | 001d747c2baf |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/changelog.rs Mon Mar 08 19:07:29 2021 +0100 +++ b/rust/hg-core/src/revlog/changelog.rs Wed Mar 03 16:40:03 2021 +0100 @@ -1,8 +1,8 @@ use crate::errors::HgError; use crate::repo::Repo; use crate::revlog::revlog::{Revlog, RevlogError}; -use crate::revlog::NodePrefix; use crate::revlog::Revision; +use crate::revlog::{Node, NodePrefix}; /// A specialized `Revlog` to work with `changelog` data format. pub struct Changelog { @@ -34,6 +34,10 @@ let bytes = self.revlog.get_rev_data(rev)?; Ok(ChangelogEntry { bytes }) } + + pub fn node_from_rev(&self, rev: Revision) -> Option<&Node> { + Some(self.revlog.index.get_entry(rev)?.hash()) + } } /// `Changelog` entry which knows how to interpret the `changelog` data bytes.