changeset 50747:9865af7191d2 stable

rust-changelog: removed now useless early conditional for NULL_REVISION Now that the underlying `RevlogEntry` returned for `NULL_REVISION` is viable, it has become pointless to check NULL_REVISION several times, even for performance: the check will be far more frequent than the benefit of bailing earlier in the rare case where the requested revision is `NULL_REVISION`. This case is covered explicitly by the first assertion of `test_data_from_rev_null`.
author Georges Racinet <georges.racinet@octobus.net>
date Thu, 06 Jul 2023 11:58:24 +0200
parents 124c44b5cfad
children 3ffc7209bbae
files rust/hg-core/src/revlog/changelog.rs
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/changelog.rs	Thu Jul 06 11:53:40 2023 +0200
+++ b/rust/hg-core/src/revlog/changelog.rs	Thu Jul 06 11:58:24 2023 +0200
@@ -1,6 +1,6 @@
 use crate::errors::HgError;
+use crate::revlog::Revision;
 use crate::revlog::{Node, NodePrefix};
-use crate::revlog::{Revision, NULL_REVISION};
 use crate::revlog::{Revlog, RevlogEntry, RevlogError};
 use crate::utils::hg_path::HgPath;
 use crate::vfs::Vfs;
@@ -51,9 +51,6 @@
         &self,
         rev: Revision,
     ) -> Result<ChangelogRevisionData, RevlogError> {
-        if rev == NULL_REVISION {
-            return Ok(ChangelogRevisionData::null());
-        }
         self.entry_for_rev(rev)?.data()
     }