aboutsummaryrefslogtreecommitdiff
path: root/apps/servers/octopus/supergit/src/bin/test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'apps/servers/octopus/supergit/src/bin/test.rs')
-rw-r--r--apps/servers/octopus/supergit/src/bin/test.rs38
1 files changed, 31 insertions, 7 deletions
diff --git a/apps/servers/octopus/supergit/src/bin/test.rs b/apps/servers/octopus/supergit/src/bin/test.rs
index 3b5fad9462cf..505580a860ce 100644
--- a/apps/servers/octopus/supergit/src/bin/test.rs
+++ b/apps/servers/octopus/supergit/src/bin/test.rs
@@ -1,6 +1,7 @@
//! A test binary to use during development
-use supergit::raw::RawRepository;
+use std::sync::mpsc::channel;
+use supergit::{BranchCommit, Repository};
fn main() {
let path = match std::env::args().nth(1) {
@@ -11,13 +12,36 @@ fn main() {
}
};
- let rr = RawRepository::open(path.as_str()).unwrap();
- let branches = rr.parse_branches().unwrap();
+ let repo = Repository::open(path.as_str()).unwrap();
- for branch in branches {
- if branch.name.as_str() != "main" && continue {}
- println!("Branch: {}", branch.name);
+ let (tx, rx) = channel();
+ let branches = repo.branches().unwrap();
- branch.enumerate(" ".into(), &rr.inner);
+ branches
+ .into_iter()
+ .filter(|b| b.name == Some("main".to_string()))
+ .for_each(|b| tx.send(b.get_all()).unwrap());
+
+ // Iterate over all branch iterators we get
+ while let Some(biter) = rx.recv().ok() {
+ use BranchCommit::*;
+ biter.for_each(|bc| match bc {
+ Commit(c) => println!("{}: {}", c.id_str(), c.summary()),
+ Merge(c, b) => {
+ // println!("[MERGE] {}: {}", c.id_str(), c.summary());
+ // tx.send(b.get_all()).unwrap();
+ }
+ _ => todo!(),
+ });
}
+
+ // let rr = RawRepository::open(path.as_str()).unwrap();
+ // let branches = rr.parse_branches().unwrap();
+
+ // for branch in branches {
+ // if branch.name.as_str() != "main" && continue {}
+ // println!("Branch: {}", branch.name);
+
+ // branch.enumerate(" ".into(), &rr.inner);
+ // }
}