aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMx Kookie <kookie@spacekookie.de>2020-11-04 03:41:27 +0100
committerMx Kookie <kookie@spacekookie.de>2020-12-21 05:19:38 +0100
commit81dbf21e0b48b0d2a964a897d72fbec7c5803399 (patch)
tree401c47461b4e85d293283e98aca08d80a8cf25f0 /apps
parent3eb540956612589f97b089cd05ef35ed2fb63efe (diff)
octopus: implementing octopus merge parsing
Diffstat (limited to 'apps')
-rw-r--r--apps/servers/octopus/supergit/src/bin/test.rs21
-rw-r--r--apps/servers/octopus/supergit/src/branch.rs8
-rw-r--r--apps/servers/octopus/supergit/src/commit.rs7
3 files changed, 21 insertions, 15 deletions
diff --git a/apps/servers/octopus/supergit/src/bin/test.rs b/apps/servers/octopus/supergit/src/bin/test.rs
index 6a370dd3716b..25652ed0bd34 100644
--- a/apps/servers/octopus/supergit/src/bin/test.rs
+++ b/apps/servers/octopus/supergit/src/bin/test.rs
@@ -30,21 +30,14 @@ fn main() {
Commit(c) => println!("{}: {}", c.id_str(), c.summary()),
Merge(c, _b) => {
println!("{}: {}", c.id_str(), c.summary());
- // tx.send(b.get_all()).unwrap();
+ tx.send(_b.get_all()).unwrap();
+ }
+ Octopus(c, branches) => {
+ println!("{}: {}", c.id_str(), c.summary());
+ for _b in branches {
+ tx.send(_b.get_all()).unwrap();
+ }
}
- _ => todo!(),
});
-
- break;
}
-
- // 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);
- // }
}
diff --git a/apps/servers/octopus/supergit/src/branch.rs b/apps/servers/octopus/supergit/src/branch.rs
index 57b47684c361..fe555d24292f 100644
--- a/apps/servers/octopus/supergit/src/branch.rs
+++ b/apps/servers/octopus/supergit/src/branch.rs
@@ -121,7 +121,13 @@ impl BranchIter {
let p2 = self.parents(&curr).1.unwrap();
BranchCommit::Merge(curr, Branch::without_name(&self.repo, p2.id))
}
- _ => panic!("Octopus merges not yet implemented!"),
+ _ => BranchCommit::Octopus(
+ curr.clone(),
+ curr.parents()
+ .into_iter()
+ .map(|c| Branch::without_name(&self.repo, c.id))
+ .collect(),
+ ),
}
}
diff --git a/apps/servers/octopus/supergit/src/commit.rs b/apps/servers/octopus/supergit/src/commit.rs
index dc8c18a0c98b..41c827f64d82 100644
--- a/apps/servers/octopus/supergit/src/commit.rs
+++ b/apps/servers/octopus/supergit/src/commit.rs
@@ -51,6 +51,13 @@ impl Commit {
.and_then(|c| Self::new(&self.repo, c.id().into()))
}
+ pub fn parents(&self) -> Vec<Commit> {
+ self.find()
+ .parents()
+ .map(|c| Self::new(&self.repo, c.id().into()).unwrap())
+ .collect()
+ }
+
fn find(&self) -> git2::Commit {
self.repo.find_commit(self.id.to_oid()).unwrap()
}