Skip to content

Commit

Permalink
Move configs to settings.rs, update/add some symbols.
Browse files Browse the repository at this point in the history
  • Loading branch information
algmyr committed Apr 13, 2024
1 parent 485d9ad commit a56c7f5
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 23 deletions.
2 changes: 1 addition & 1 deletion cli/src/config/colors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@
"node elided" = { fg = "bright black" }
"node working_copy" = { fg = "green" }
"node immutable" = { fg = "bright cyan" }
"node wip" = { fg = "yellow" }
"node conflict" = { fg = "red" }
"node normal" = { bold = false }
13 changes: 0 additions & 13 deletions cli/src/config/templates.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ log = 'builtin_log_compact'
op_log = 'builtin_op_log_compact'
show = 'builtin_log_detailed'

op_log_node = 'if(current_operation, "@", "◉")'

log_node = '''
label("node",
coalesce(
if(!self, label("elided", "⇋")),
if(current_working_copy, label("working_copy", "@")),
if(immutable, label("immutable", "◆")),
label("normal", "○")
)
)
'''

[template-aliases]
builtin_log_oneline = '''
if(root,
Expand Down
12 changes: 7 additions & 5 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,13 @@ By default, the following graph nodes are shown to the user:
* The working-copy-commit is the `@` symbol, and is green.
* Immutable nodes (as specified by the `immutable_heads()` revset) are
represented with blue diamonds ``
* Mutable commits are represented with ordinary uncolored circles ``
* "Elided nodes" are specified with the "harpoon" symbol `` to show that
there are commits between the two nodes that are "cut" out, and not shown.
* Commits whose description begins with `wip:` are represented with a yellow
`!` symbol.
* Conflicted commits are represented with red crosses `×`.
* Other mutable commits are represented with ordinary uncolored circles ``
* "Elided nodes" are represented with a tilde `~` to reflect the similarity
to its usage for graphs with cut roots.

For the ascii style graph colors are the same, while symbols differ due to
the character set restriction.

These symbols are chosen to be visually distinct from one another, with distinct
colors. However, certain Unicode characters may not render correctly in all
Expand Down
42 changes: 38 additions & 4 deletions lib/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,50 @@ impl UserSettings {
pub fn commit_node_template(&self) -> String {
self.node_template_for_key(
"templates.log_node",
r#"if(self, if(current_working_copy, "@", "◉"), "◌")"#,
r#"if(self, if(current_working_copy, "@", "o"), ".")"#,
r#"
label("node",
coalesce(
if(!self, label("elided", "~")),
if(current_working_copy, label("working_copy", "@")),
if(immutable, label("immutable", "◆")),
if(conflict, label("conflict", "×")),
label("normal", "○"),
)
)
"#,
r##"
label("node",
coalesce(
if(!self, label("elided", "~")),
if(current_working_copy, label("working_copy", "@")),
if(immutable, label("immutable", "#")),
if(conflict, label("conflict", "x")),
label("normal", "o"),
)
)
"##,
)
}

pub fn op_node_template(&self) -> String {
self.node_template_for_key(
"templates.op_log_node",
r#"if(current_operation, "@", "◉")"#,
r#"if(current_operation, "@", "o")"#,
r#"
label("node",
coalesce(
if(current_operation, label("working_copy", "@")),
"○",
)
)
"#,
r#"
label("node",
coalesce(
if(current_operation, label("working_copy", "@")),
"o",
)
)
"#,
)
}

Expand Down

0 comments on commit a56c7f5

Please sign in to comment.