mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-13 07:32:20 +00:00
cli: key nodes in graphlog by position in index instead of by commit id
This speeds up `jj log -T "" -r ,,v2.0.0` in the git.git repo by about 1.6 dB (~31%).
This commit is contained in:
parent
0145be3693
commit
67ca161f24
1 changed files with 4 additions and 4 deletions
|
@ -1062,23 +1062,23 @@ fn cmd_log(
|
|||
if use_graph {
|
||||
let mut graph = AsciiGraphDrawer::new(&mut styler);
|
||||
for index_entry in revset.iter() {
|
||||
let commit = store.get_commit(&index_entry.commit_id()).unwrap();
|
||||
let mut edges = vec![];
|
||||
for parent in commit.parents() {
|
||||
for parent_position in index_entry.parent_positions() {
|
||||
// TODO: Use the right kind of edge here.
|
||||
edges.push(Edge::direct(parent.id().clone()));
|
||||
edges.push(Edge::direct(parent_position));
|
||||
}
|
||||
let mut buffer = vec![];
|
||||
// TODO: only use color if requested
|
||||
{
|
||||
let writer = Box::new(&mut buffer);
|
||||
let mut styler = ColorStyler::new(writer, ui.settings());
|
||||
let commit = store.get_commit(&index_entry.commit_id()).unwrap();
|
||||
template.format(&commit, &mut styler)?;
|
||||
}
|
||||
if !buffer.ends_with(b"\n") {
|
||||
buffer.push(b'\n');
|
||||
}
|
||||
graph.add_node(commit.id(), &edges, b"o", &buffer)?;
|
||||
graph.add_node(&index_entry.position(), &edges, b"o", &buffer)?;
|
||||
}
|
||||
} else {
|
||||
for index_entry in revset.iter() {
|
||||
|
|
Loading…
Reference in a new issue