summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-05-07 13:51:24 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-05-07 13:51:24 +0200
commit362ee2f641ee5578dc492df752151df3077d324f (patch)
treebfee2b8f52c6d466a48daf7d25a11706b23754cb
parent08d2797b37219004e5bcb08da2a1c8ad0f4e7be6 (diff)
Annotate types in the graphHEADmaster
-rw-r--r--src/main.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index d6e9013..b891595 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -148,11 +148,11 @@ fn write_dot<W: Write, F: Fn(&git2::Oid) -> bool>(stream: &mut W, history: &mut
match history.node_for(key).unwrap() {
HistoryNode::Genesis(oid) => {
- writeln!(stream, "\t\"{}\" [label=\"G\"];", oid)?;
+ writeln!(stream, "\t\"{}\" [label=\"G= {}\"];", oid, oid)?;
next_keys = Vec::new();
},
HistoryNode::Reference(oid, parents) => {
- writeln!(stream, "\t\"{}\" [label=\"{}\"];", oid, refmap.get(oid).unwrap().reference.shorthand().expect("Reference name not valid utf8"))?;
+ writeln!(stream, "\t\"{}\" [label=\"R= {}\"];", oid, refmap.get(oid).unwrap().reference.shorthand().expect("Reference name not valid utf8"))?;
// writeln!(stream, "\t\"{}\" [label=\"R\"];", oid)?;
for &parent in parents {
let node = history.node_for(parent).unwrap();
@@ -161,7 +161,7 @@ fn write_dot<W: Write, F: Fn(&git2::Oid) -> bool>(stream: &mut W, history: &mut
next_keys = parents.clone();
},
HistoryNode::Merge(oid, parents) => {
- writeln!(stream, "\t\"{}\" [label=\"\"];", oid)?;
+ writeln!(stream, "\t\"{}\" [label=\"M= {}\"];", oid, if (history.is_reference)(oid) { refmap.get(oid).unwrap().reference.shorthand().expect("Reference name not valid utf8") } else { "" })?;
for &parent in parents {
let node = history.node_for(parent).unwrap();
writeln!(stream, "\t\"{}\" -> \"{}\";", node.oid(), oid)?;
@@ -190,15 +190,17 @@ fn main() -> Result<()> {
for reference in repo.references().to_io_result()? {
let reference = reference.to_io_result()?;
+ eprintln!("reference: {:?}", reference.name());
if reference.is_tag() || reference.is_remote() {
let reference = reference.resolve().to_io_result()?;
match reference.peel_to_commit() {
Ok(commit) => {
- let oid = reference.target().expect("Resolved reference is not a direct reference?");
+ // let oid = reference.target().expect("Resolved reference is not a direct reference?");
+ eprintln!(" -> taken commit id \x1B[41m{}\x1B[0m", commit.id());
+ // eprintln!("{} {}",
+ // reference.name().expect("Invalid utf8 in reference name"),
+ // commit.id());
refmap.insert(commit.id(), RefInfo { reference, commit });
- // println!("{} {}",
- // reference.name().expect("Invalid utf8 in reference name"),
- // commit.id());
}
Err(_) => {},
}