##// END OF EJS Templates
rust: Make private the `index` field of the `Revlog` struct...
Simon Sapin -
r48781:6c653d9d default
parent child Browse files
Show More
@@ -36,7 +36,7 b' impl Changelog {'
36 }
36 }
37
37
38 pub fn node_from_rev(&self, rev: Revision) -> Option<&Node> {
38 pub fn node_from_rev(&self, rev: Revision) -> Option<&Node> {
39 Some(self.revlog.index.get_entry(rev)?.hash())
39 self.revlog.node_from_rev(rev)
40 }
40 }
41 }
41 }
42
42
@@ -18,7 +18,7 b' use super::patch;'
18 use crate::errors::HgError;
18 use crate::errors::HgError;
19 use crate::repo::Repo;
19 use crate::repo::Repo;
20 use crate::revlog::Revision;
20 use crate::revlog::Revision;
21 use crate::NULL_REVISION;
21 use crate::{Node, NULL_REVISION};
22
22
23 #[derive(derive_more::From)]
23 #[derive(derive_more::From)]
24 pub enum RevlogError {
24 pub enum RevlogError {
@@ -51,7 +51,7 b' pub struct Revlog {'
51 /// When index and data are not interleaved: bytes of the revlog index.
51 /// When index and data are not interleaved: bytes of the revlog index.
52 /// When index and data are interleaved: bytes of the revlog index and
52 /// When index and data are interleaved: bytes of the revlog index and
53 /// data.
53 /// data.
54 pub(crate) index: Index,
54 index: Index,
55 /// When index and data are not interleaved: bytes of the revlog data
55 /// When index and data are not interleaved: bytes of the revlog data
56 data_bytes: Option<Box<dyn Deref<Target = [u8]> + Send>>,
56 data_bytes: Option<Box<dyn Deref<Target = [u8]> + Send>>,
57 /// When present on disk: the persistent nodemap for this revlog
57 /// When present on disk: the persistent nodemap for this revlog
@@ -119,6 +119,11 b' impl Revlog {'
119 self.index.is_empty()
119 self.index.is_empty()
120 }
120 }
121
121
122 /// Returns the node ID for the given revision number, if it exists in this revlog
123 pub fn node_from_rev(&self, rev: Revision) -> Option<&Node> {
124 Some(self.index.get_entry(rev)?.hash())
125 }
126
122 /// Return the full data associated to a node.
127 /// Return the full data associated to a node.
123 #[timed]
128 #[timed]
124 pub fn get_node_rev(
129 pub fn get_node_rev(
General Comments 0
You need to be logged in to leave comments. Login now