summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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(_) => {},
}