diff rust/hg-core/src/revlog/revlog.rs @ 48236:f8dc78716ad2

rhg: fix `hg cat` interaction with null revision Differential Revision: https://phab.mercurial-scm.org/D11664
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Thu, 14 Oct 2021 19:02:08 +0100
parents 4518d91f02d8
children 1fb3615dfce2
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/revlog.rs	Fri Oct 15 01:27:39 2021 +0200
+++ b/rust/hg-core/src/revlog/revlog.rs	Thu Oct 14 19:02:08 2021 +0100
@@ -133,6 +133,9 @@
     /// 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> {
+        if rev == NULL_REVISION {
+            return Some(&NULL_NODE);
+        }
         Some(self.index.get_entry(rev)?.hash())
     }