Skip to content

FR: Highlight private commits in the log output #7807

@Vampire

Description

@Vampire

Is your feature request related to a problem? Please describe.
I'd like to see a visual indication of private commits in the default log templates.

Describe the solution you'd like
Some visual indication of private commits in the default log template, for example a special symbol and color in the graph.

Describe alternatives you've considered
Custom templates can of course do it, but always have the potential problem that you miss improvements done in the built-in templates, and I think if someone configured private commits, it also makes sense to visualize them for seeing which commits are private and also for easily verifying the configuration is as intended.

This is what I use right now:

[revset-aliases]
"private()" = "..bookmarks(glob-i:'local/*')"
"private_commits()" = "private() ~ immutable() ~ ..remote_bookmarks()"
"push_bookmarks()" = "(remote_bookmarks(remote=origin)..@ ~ private_commits()) & bookmarks()"

[git]
private-commits = "private()"

[templates]
log_node = """
if(
  config("ui.graph.style").as_string().starts_with("ascii"),
  log_node_ascii,
  log_node
)
"""

[template-aliases]
log_node = """
coalesce(
  if(!self, label("elided", "~")),
  label(
    separate(" ",
      if(current_working_copy, "working_copy"),
      if(immutable, "immutable", "mutable"),
      if(conflict, "conflicted"),
      if(self.contained_in("private_commits()"), "private"),
    ),
    coalesce(
      if(current_working_copy, "@"),
      if(immutable, "◆"),
      if(conflict, "×"),
      if(self.contained_in("private_commits()"), "★"),
      "○",
    )
  )
)
"""
log_node_ascii = """
coalesce(
  if(!self, label("elided", "~")),
  label(
    separate(" ",
      if(current_working_copy, "working_copy"),
      if(immutable, "immutable", "mutable"),
      if(conflict, "conflicted"),
      if(self.contained_in("private_commits()"), "private"),
    ),
    coalesce(
      if(current_working_copy, "@"),
      if(immutable, "+"),
      if(conflict, "x"),
      if(self.contained_in("private_commits()"), "*"),
      "o",
    )
  )
)
"""

[colors]
private = "bright red"

[revsets]
git-push = "push_bookmarks()

with this being the diff from the built-in templates:

$ diff -uw <(JJ_CONFIG= jj config get templates.log_node) <(jj config get templates.log_node)
--- /dev/fd/63  2025-10-21 19:01:36.000000000 +0200
+++ /dev/fd/62  2025-10-21 19:01:36.000000000 +0200
@@ -1,6 +1,6 @@
 if(
   config("ui.graph.style").as_string().starts_with("ascii"),
-  builtin_log_node_ascii,
-  builtin_log_node
+  log_node_ascii,
+  log_node
 )

$ diff -uw <(JJ_CONFIG= jj config get template-aliases.builtin_log_node) <(jj config get template-aliases.log_node)
--- /dev/fd/63  2025-10-21 19:01:51.000000000 +0200
+++ /dev/fd/62  2025-10-21 19:01:51.000000000 +0200
@@ -5,11 +5,13 @@
       if(current_working_copy, "working_copy"),
       if(immutable, "immutable", "mutable"),
       if(conflict, "conflicted"),
+      if(self.contained_in("private_commits()"), "private"),
     ),
     coalesce(
       if(current_working_copy, "@"),
       if(immutable, "◆"),
       if(conflict, "×"),
+      if(self.contained_in("private_commits()"), "★"),
       "○",
     )
   )
$ diff -uw <(JJ_CONFIG= jj config get template-aliases.builtin_log_node_ascii) <(jj config get template-aliases.log_node_ascii)
--- /dev/fd/63  2025-10-21 19:02:02.000000000 +0200
+++ /dev/fd/62  2025-10-21 19:02:02.000000000 +0200
@@ -5,11 +5,13 @@
       if(current_working_copy, "working_copy"),
       if(immutable, "immutable", "mutable"),
       if(conflict, "conflicted"),
+      if(self.contained_in("private_commits()"), "private"),
     ),
     coalesce(
       if(current_working_copy, "@"),
       if(immutable, "+"),
       if(conflict, "x"),
+      if(self.contained_in("private_commits()"), "*"),
       "o",
     )
   )

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions