From 91e4d4f3acc726a00a9c4ca8b2b6c7341c327423 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Sat, 14 Dec 2024 21:50:39 +0100 Subject: [PATCH 1/2] jj-fzf: display 'immutable' as a flag in preview Signed-off-by: Tim Janik --- jj-fzf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jj-fzf b/jj-fzf index eab619d..e6768f5 100755 --- a/jj-fzf +++ b/jj-fzf @@ -11,8 +11,10 @@ concat( builtin_log_oneline, "Change ID: " ++ self.change_id() ++ "\n", "Commit ID: " ++ commit_id ++ "\n", + "Flags: ", separate(" ", + if(immutable, label("node immutable", "immutable")), + ) ++ "\n", surround("Refs: ", "\n", separate(" ", local_bookmarks, remote_bookmarks, tags)), - if(immutable, "Immutable: " ++ label("description placeholder", "true") ++ "\n"), "Parents: " ++ self.parents().map(|c| " " ++ c.change_id()) ++ "\n", "Author: " ++ format_detailed_signature(author) ++ "\n", "Committer: " ++ format_detailed_signature(committer) ++ "\n\n", From acb8c1a1e6da366c5311925b19fe7cbbeed7fdb1 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Sat, 14 Dec 2024 21:50:39 +0100 Subject: [PATCH 2/2] jj-fzf: display 'private' as a flag in preview * Add a star icon to the jj log oneline view for commits from the git.private-commits revset Signed-off-by: Tim Janik --- jj-fzf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jj-fzf b/jj-fzf index e6768f5..2e7684e 100755 --- a/jj-fzf +++ b/jj-fzf @@ -5,7 +5,8 @@ SCRIPTNAME=`basename $0` && function die { [ -n "$*" ] && echo "$SCRIPTNAME: ** SELF="$0" # == PREVIEW fast path == -export REVPAT='^[^a-z()0-9]*([k-xyz]{7,})([?]*)\ ' # line start, ignore --graph, parse revision letters, catch '??'-postfix +JJFZF_PRIVATE="$(jj config get --ignore-working-copy --no-pager git.private-commits 2>/dev/null)" && + [[ "$JJFZF_PRIVATE" =~ ^[.a-z_()-]+$ ]] || JJFZF_PRIVATE='' # only supported unquoted revset names JJ_FZF_SHOWDETAILS=' concat( builtin_log_oneline, @@ -13,6 +14,7 @@ concat( "Commit ID: " ++ commit_id ++ "\n", "Flags: ", separate(" ", if(immutable, label("node immutable", "immutable")), + '"${JJFZF_PRIVATE:+ if(self.contained_in('$JJFZF_PRIVATE') && !immutable, label('committer', 'private')), }"' ) ++ "\n", surround("Refs: ", "\n", separate(" ", local_bookmarks, remote_bookmarks, tags)), "Parents: " ++ self.parents().map(|c| " " ++ c.change_id()) ++ "\n", @@ -22,6 +24,7 @@ concat( coalesce(description, label(if(empty, "empty"), description_placeholder) ++ "\n")), "\n", )' # extended version of builtin_log_detailed; https://github.com/martinvonz/jj/blob/main/cli/src/config/templates.toml +export REVPAT='^[^a-z()0-9]*([k-xyz]{7,})([?]*)\ ' # line start, ignore --graph, parse revision letters, catch '??'-postfix if test "${1:-}" == preview # preview command, nested invocation then if [[ "${2:-} " =~ $REVPAT ]] # match beginning of jj log line @@ -145,6 +148,7 @@ if(root, if(git_head, label("git_head", "git_head()")), if(conflict, label("conflict", "conflict")), if(empty, label("empty", "(empty)")), + '"${JJFZF_PRIVATE:+ if(self.contained_in('$JJFZF_PRIVATE') && !immutable, label('committer', '🌟')), }"' if(description, description.first_line(), label(if(empty, "empty"), description_placeholder),