From 10ee2acdd26a7f1298c6f6d6b7af9b469fe29b87 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 14:41:41 +0200 Subject: Merging upstream version 1.70.0+dfsg2. Signed-off-by: Daniel Baumann --- vendor/git2/src/revspec.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 vendor/git2/src/revspec.rs (limited to 'vendor/git2/src/revspec.rs') diff --git a/vendor/git2/src/revspec.rs b/vendor/git2/src/revspec.rs new file mode 100644 index 000000000..d2e08670a --- /dev/null +++ b/vendor/git2/src/revspec.rs @@ -0,0 +1,34 @@ +use crate::{Object, RevparseMode}; + +/// A revspec represents a range of revisions within a repository. +pub struct Revspec<'repo> { + from: Option>, + to: Option>, + mode: RevparseMode, +} + +impl<'repo> Revspec<'repo> { + /// Assembles a new revspec from the from/to components. + pub fn from_objects( + from: Option>, + to: Option>, + mode: RevparseMode, + ) -> Revspec<'repo> { + Revspec { from, to, mode } + } + + /// Access the `from` range of this revspec. + pub fn from(&self) -> Option<&Object<'repo>> { + self.from.as_ref() + } + + /// Access the `to` range of this revspec. + pub fn to(&self) -> Option<&Object<'repo>> { + self.to.as_ref() + } + + /// Returns the intent of the revspec. + pub fn mode(&self) -> RevparseMode { + self.mode + } +} -- cgit v1.2.3