octopus: implementing octopus merge parsing

wip/yesman
Katharina Fey 4 years ago
parent 3eb5409566
commit 81dbf21e0b
  1. 21
      apps/servers/octopus/supergit/src/bin/test.rs
  2. 8
      apps/servers/octopus/supergit/src/branch.rs
  3. 7
      apps/servers/octopus/supergit/src/commit.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);
// }
}

@ -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(),
),
}
}

@ -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()
}

Loading…
Cancel
Save