# HG changeset patch # User Arseniy Alekseyev # Date 1634234528 -3600 # Node ID f8dc78716ad2b8357fe5e41a3dbd1acef9d1fa38 # Parent 5c567aca080d255a9d5c4daf44370e59892b61d0 rhg: fix `hg cat` interaction with null revision Differential Revision: https://phab.mercurial-scm.org/D11664 diff -r 5c567aca080d -r f8dc78716ad2 rust/hg-core/src/revlog/revlog.rs --- 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()) } diff -r 5c567aca080d -r f8dc78716ad2 tests/test-rhg.t --- a/tests/test-rhg.t Fri Oct 15 01:27:39 2021 +0200 +++ b/tests/test-rhg.t Thu Oct 14 19:02:08 2021 +0100 @@ -129,8 +129,8 @@ $ $NO_FALLBACK rhg cat -r d file-2 2 $ $NO_FALLBACK rhg cat -r 0000 file-2 - abort: invalid revision identifier: 0000 - [255] + file-2: no such file in rev 000000000000 + [1] Cat files $ cd $TESTTMP