diff rust/hg-core/src/revlog/changelog.rs @ 47964:796206e74b10

rhg: Reuse manifest when checking status of multiple ambiguous files When `rhg status` cannot determine whether a file is clean based on mtime and size alone, it needs to compare its contents with those found in the parent commit. Previously, rhg would find the (same) manifest of that commit again for every such file. This is lifted out of the loop and reused. Differential Revision: https://phab.mercurial-scm.org/D11411
author Simon Sapin <simon.sapin@octobus.net>
date Mon, 13 Sep 2021 18:09:10 +0200
parents 001d747c2baf
children 6c653d9d41b8
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/changelog.rs	Mon Sep 13 18:02:45 2021 +0200
+++ b/rust/hg-core/src/revlog/changelog.rs	Mon Sep 13 18:09:10 2021 +0200
@@ -57,9 +57,11 @@
 
     /// Return the node id of the `manifest` referenced by this `changelog`
     /// entry.
-    pub fn manifest_node(&self) -> Result<&[u8], RevlogError> {
-        self.lines()
-            .next()
-            .ok_or_else(|| HgError::corrupted("empty changelog entry").into())
+    pub fn manifest_node(&self) -> Result<Node, HgError> {
+        Node::from_hex_for_repo(
+            self.lines()
+                .next()
+                .ok_or_else(|| HgError::corrupted("empty changelog entry"))?,
+        )
     }
 }