-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make node symbols templatable in the graphs #3313
Conversation
3fd7760
to
6884ce8
Compare
Not at all. I appreciate you working on this, thank you! I skimmed through the changes. Nice work! Seems fine to me, but I'll let owners properly review them.
I wondered almost the same questions. I was also wondering should there be different templates for different kinds of graphs (log, op log, obslog)? And users would be able to override them in their config, like for example: [templates]
graph-log = 'my_fancy_graph_log'
graph-op-log = 'my_simple_graph_log'
graph-obslog = 'my_simple_graph_log' |
6884ce8
to
230f1df
Compare
0c84e6f
to
d0d5b1e
Compare
d0d5b1e
to
b86f6df
Compare
Another open question. It seems feasible to include the elided revision text in the template and stop having it be hard-coded, and it seems some people have been eager to have the ability to not have that. Is it worth making the default something like this?
|
b86f6df
to
e6dafb0
Compare
e6dafb0
to
4d17661
Compare
Then we would have to split that up after reading it from the config (or maybe after rendering it), right? Because the node is passed separately from the text to the graph renderer. |
One option is to just write a newline in the graph, but it feels a bit hacky and maybe the two spaces for alignment in the template is not always the right spacing? let elided_key = (elided_target, true);
let real_key = (elided_key.0.clone(), false);
let edges = [Edge::Direct(real_key)];
- let mut buffer = vec![];
- with_content_format.write_graph_text(
- ui.new_formatter(&mut buffer).as_mut(),
- |formatter| writeln!(formatter.labeled("elided"), "(elided revisions)"),
- || graph.width(&elided_key, &edges),
- )?;
let node_symbol = format_template(ui, &(), elided_node_template.as_ref());
graph.add_node(
&elided_key,
&edges,
&node_symbol,
- &String::from_utf8_lossy(&buffer),
+ &"\n",
)?;
}
}
|
Right, there can be lines to the right of the elided node, like this:
|
Gotcha, let's just leave things as is then. I guess there could be yet another template introduced in the future if someone really wants it. |
4d17661
to
c786889
Compare
72284c9
to
82f5349
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks, but I'll let @yuja give the final approval since he's already done a few rounds of reviews
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, looks good, thanks!
Two questions:
- Will you merge this soon? or rebase atop templater: don't define TemplateLanguage::Context statically #3332?
- Do you like the idea of rendering elided node as
None
? commit_templater: encode elided node asOption<Commit>
#3319 (comment)
(To be clear, I don't intend to block this PR. I can reorder my PRs even if we agree with Option<Commit>
idea.)
82f5349
to
f55adb8
Compare
Adds config options * templates.log_graph_node * templates.log_graph_node_elided * templates.op_log_graph_node
f55adb8
to
47cb14e
Compare
No-op change styling wise for now. I suspect there will be room for bikeshedding the default style after this.
Hopefully I'm not stepping on @zummenix's toes too much here after the great idea in #3260 to just use a separate template for the elided node. 😅
Some stuff is a bit odd still, like what template to even use for the elided node? Commit template for the root it happens to be associated with? Just make it not a template and let it be a string?
Still need to update docs.
Hopefully just dropping the symbol configs I added recently is fine, especially considering there hasn't been a release with them included.
Checklist
If applicable:
CHANGELOG.md