diff rust/hg-core/src/revlog/revlog.rs @ 46433:4b381dbbf8b7

rhg: centralize parsing of `--rev` CLI arguments This new module will be the place to implement more of the revset language when we do so. Differential Revision: https://phab.mercurial-scm.org/D9873
author Simon Sapin <simon.sapin@octobus.net>
date Tue, 26 Jan 2021 18:31:46 +0100
parents 645ee7225fab
children 43d63979a75e
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/revlog.rs	Mon Jan 25 18:25:26 2021 +0100
+++ b/rust/hg-core/src/revlog/revlog.rs	Tue Jan 26 18:31:46 2021 +0100
@@ -150,6 +150,11 @@
         found_by_prefix.ok_or(RevlogError::InvalidRevision)
     }
 
+    /// Returns whether the given revision exists in this revlog.
+    pub fn has_rev(&self, rev: Revision) -> bool {
+        self.index.get_entry(rev).is_some()
+    }
+
     /// Return the full data associated to a revision.
     ///
     /// All entries required to build the final data out of deltas will be