summaryrefslogtreecommitdiffstats
path: root/vendor/git2/src/revspec.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:47:55 +0000
commit2aadc03ef15cb5ca5cc2af8a7c08e070742f0ac4 (patch)
tree033cc839730fda84ff08db877037977be94e5e3a /vendor/git2/src/revspec.rs
parentInitial commit. (diff)
downloadcargo-upstream.tar.xz
cargo-upstream.zip
Adding upstream version 0.70.1+ds1.upstream/0.70.1+ds1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/git2/src/revspec.rs')
-rw-r--r--vendor/git2/src/revspec.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/git2/src/revspec.rs b/vendor/git2/src/revspec.rs
new file mode 100644
index 0000000..d2e0867
--- /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<Object<'repo>>,
+ to: Option<Object<'repo>>,
+ mode: RevparseMode,
+}
+
+impl<'repo> Revspec<'repo> {
+ /// Assembles a new revspec from the from/to components.
+ pub fn from_objects(
+ from: Option<Object<'repo>>,
+ to: Option<Object<'repo>>,
+ 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
+ }
+}