diff --git a/rust/hg-core/src/operations/cat.rs b/rust/hg-core/src/operations/cat.rs --- a/rust/hg-core/src/operations/cat.rs +++ b/rust/hg-core/src/operations/cat.rs @@ -50,7 +50,7 @@ found_any = true; let file_log = repo.filelog(manifest_file)?; let file_node = Node::from_hex_for_repo(node_bytes)?; - let entry = file_log.get_node(file_node)?; + let entry = file_log.data_for_node(file_node)?; bytes.extend(entry.data()?) } } diff --git a/rust/hg-core/src/repo.rs b/rust/hg-core/src/repo.rs --- a/rust/hg-core/src/repo.rs +++ b/rust/hg-core/src/repo.rs @@ -336,26 +336,29 @@ self.manifestlog.get_mut_or_init(self) } - /// Returns the manifest of the given node ID + /// Returns the manifest of the *changeset* with the given node ID pub fn manifest_for_node( &self, node: impl Into, ) -> Result { - self.manifestlog()?.get_node( + self.manifestlog()?.data_for_node( self.changelog()? - .get_node(node.into())? + .data_for_node(node.into())? .manifest_node()? .into(), ) } - /// Returns the manifest of the given revision + /// Returns the manifest of the *changeset* with the given revision number pub fn manifest_for_rev( &self, revision: Revision, ) -> Result { - self.manifestlog()?.get_node( - self.changelog()?.get_rev(revision)?.manifest_node()?.into(), + self.manifestlog()?.data_for_node( + self.changelog()? + .data_for_rev(revision)? + .manifest_node()? + .into(), ) } 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 @@ -17,17 +17,17 @@ Ok(Self { revlog }) } - /// Return the `ChangelogEntry` a given node id. - pub fn get_node( + /// Return the `ChangelogEntry` for the given node ID. + pub fn data_for_node( &self, node: NodePrefix, ) -> Result { let rev = self.revlog.rev_from_node(node)?; - self.get_rev(rev) + self.data_for_rev(rev) } - /// Return the `ChangelogEntry` of a given node revision. - pub fn get_rev( + /// Return the `ChangelogEntry` of the given revision number. + pub fn data_for_rev( &self, rev: Revision, ) -> Result { diff --git a/rust/hg-core/src/revlog/filelog.rs b/rust/hg-core/src/revlog/filelog.rs --- a/rust/hg-core/src/revlog/filelog.rs +++ b/rust/hg-core/src/revlog/filelog.rs @@ -26,17 +26,17 @@ /// The given node ID is that of the file as found in a manifest, not of a /// changeset. - pub fn get_node( + pub fn data_for_node( &self, file_node: impl Into, ) -> Result { let file_rev = self.revlog.rev_from_node(file_node.into())?; - self.get_rev(file_rev) + self.data_for_rev(file_rev) } /// The given revision is that of the file as found in a manifest, not of a /// changeset. - pub fn get_rev( + pub fn data_for_rev( &self, file_rev: Revision, ) -> Result { diff --git a/rust/hg-core/src/revlog/manifest.rs b/rust/hg-core/src/revlog/manifest.rs --- a/rust/hg-core/src/revlog/manifest.rs +++ b/rust/hg-core/src/revlog/manifest.rs @@ -18,14 +18,31 @@ Ok(Self { revlog }) } - /// Return the `ManifestEntry` of a given node id. - pub fn get_node(&self, node: NodePrefix) -> Result { + /// Return the `Manifest` for the given node ID. + /// + /// Note: this is a node ID in the manifestlog, typically found through + /// `ChangelogEntry::manifest_node`. It is *not* the node ID of any + /// changeset. + /// + /// See also `Repo::manifest_for_node` + pub fn data_for_node( + &self, + node: NodePrefix, + ) -> Result { let rev = self.revlog.rev_from_node(node)?; - self.get_rev(rev) + self.data_for_rev(rev) } - /// Return the `ManifestEntry` of a given node revision. - pub fn get_rev(&self, rev: Revision) -> Result { + /// Return the `Manifest` of a given revision number. + /// + /// Note: this is a revision number in the manifestlog, *not* of any + /// changeset. + /// + /// See also `Repo::manifest_for_rev` + pub fn data_for_rev( + &self, + rev: Revision, + ) -> Result { let bytes = self.revlog.get_rev_data(rev)?; Ok(Manifest { bytes }) } diff --git a/rust/hg-core/src/revlog/revlog.rs b/rust/hg-core/src/revlog/revlog.rs --- a/rust/hg-core/src/revlog/revlog.rs +++ b/rust/hg-core/src/revlog/revlog.rs @@ -119,12 +119,14 @@ self.index.is_empty() } - /// Returns the node ID for the given revision number, if it exists in this revlog + /// Returns the node ID for the given revision number, if it exists in this + /// revlog pub fn node_from_rev(&self, rev: Revision) -> Option<&Node> { Some(self.index.get_entry(rev)?.hash()) } - /// Return the revision number for the given node ID, if it exists in this revlog + /// Return the revision number for the given node ID, if it exists in this + /// revlog #[timed] pub fn rev_from_node( &self, diff --git a/rust/rhg/src/commands/status.rs b/rust/rhg/src/commands/status.rs --- a/rust/rhg/src/commands/status.rs +++ b/rust/rhg/src/commands/status.rs @@ -270,7 +270,7 @@ .find_file(hg_path)? .expect("ambgious file not in p1"); let filelog = repo.filelog(hg_path)?; - let filelog_entry = filelog.get_node(file_node).map_err(|_| { + let filelog_entry = filelog.data_for_node(file_node).map_err(|_| { HgError::corrupted("filelog missing node from manifest") })?; let contents_in_p1 = filelog_entry.data()?;