aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcs/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcs/mod.rs')
-rw-r--r--src/vcs/mod.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/vcs/mod.rs b/src/vcs/mod.rs
new file mode 100644
index 0000000..02c2eb7
--- /dev/null
+++ b/src/vcs/mod.rs
@@ -0,0 +1,35 @@
+mod git;
+
+pub enum VcsType {
+ Git,
+}
+
+#[derive(Debug,Copy,Clone)]
+pub enum ActiveOperation {
+ None,
+ Merge,
+ Revert,
+ CherryPick,
+ Bisect,
+ Rebase,
+}
+
+pub trait VcsInfo {
+ fn vcs(&self) -> VcsType;
+ fn has_modified_files(&self) -> bool;
+ fn has_staged_files(&self) -> bool;
+ fn has_new_files(&self) -> bool;
+ fn has_commits(&self) -> bool;
+ fn active_operation(&self) -> ActiveOperation;
+ fn branch(&self) -> Option<String>;
+ fn remote_branch_diff(&self) -> Option<(usize, usize)>;
+}
+
+pub fn detect() -> Option<Box<VcsInfo>> {
+ if let Some(git) = git::detect() {
+ Some(git)
+ }
+ else {
+ None
+ }
+}