log: output heads in graph ordered by commit id instead of by hash

It was really annoying that the order kept changing as commits got
rewritten. Also, I prefer to see the latest commits at the top (like
Mercurial does it).
This commit is contained in:
Martin von Zweigbergk 2021-01-10 19:21:33 -08:00
parent 7572a32077
commit 1f53285f64

View File

@ -1036,7 +1036,8 @@ fn cmd_log(
heads = skip_uninteresting_heads(&repo, heads); heads = skip_uninteresting_heads(&repo, heads);
}; };
let mut heads: Vec<_> = heads.into_iter().collect(); let mut heads: Vec<_> = heads.into_iter().collect();
heads.sort(); heads.sort_by_key(|commit| commit.committer().timestamp.clone());
heads.reverse();
let commits = topo_order_reverse( let commits = topo_order_reverse(
heads, heads,