Skip to content

Commit

Permalink
jj-fzf: op log: add Ctrl-D: Preview the differences of an operation v…
Browse files Browse the repository at this point in the history
…ia `jj op diff`

Signed-off-by: Tim Janik <[email protected]>
  • Loading branch information
tim-janik committed Dec 9, 2024
1 parent 88d412c commit c2b327a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions jj-fzf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ case "${1:-}" in
[[ " ${2:-} " =~ $OPRPAT ]] && {
jj --no-pager --ignore-working-copy --color=always op show -p "${BASH_REMATCH[1]}"
} ; exit ;;
preview_opdiff)
[[ " ${2:-} " =~ $OPRPAT ]] && {
jj --no-pager --ignore-working-copy --color=always op diff -f "${BASH_REMATCH[1]}" -t @
} ; exit ;;
esac

# == Check Deps ==
Expand Down Expand Up @@ -941,9 +945,10 @@ op-log()
temp_dir
echo > $TEMPD/oplog.env
H=$'\n'
H="$H"$'Ctrl-S: Preview "@" at a specific operation via `jj show @`\n'
H="$H"$'Ctrl-D: Preview the differences of an operation via `jj op diff -f <op> -t @`\n'
H="$H"$'Ctrl-L: Preview history at a specific operation via `jj log -r ..`\n'
H="$H"$'Ctrl-P: Preview patch at a specific operation via `jj op show -p <op>`\n'
H="$H"$'Ctrl-P: Preview changes in an operation with patch via `jj op show -p <op>`\n'
H="$H"$'Ctrl-S: Preview "@" at a specific operation via `jj show @`\n'
H="$H"$'\n'
H="$H"$'Alt-R: Restore repository to the selected operation via `jj op restore`\n'
H="$H"$'Alt-W: Restore working copy of the selected operation into a new commit before @\n'
Expand All @@ -956,9 +961,10 @@ op-log()
--border-label '-[ OP-LOG ]-' --color=border:bright-yellow,label:bright-yellow \
--prompt "Operation > " \
--header "$H" --header-first \
--bind "ctrl-s:execute-silent( gsed 's/^VIEW=.*/VIEW=preview_opshow/' -i $TEMPD/oplog.env )+refresh-preview" \
--bind "ctrl-d:execute-silent( gsed 's/^VIEW=.*/VIEW=preview_opdiff/' -i $TEMPD/oplog.env )+refresh-preview" \
--bind "ctrl-l:execute-silent( gsed 's/^VIEW=.*/VIEW=preview_oplog/' -i $TEMPD/oplog.env )+refresh-preview" \
--bind "ctrl-p:execute-silent( gsed 's/^VIEW=.*/VIEW=preview_oppatch/' -i $TEMPD/oplog.env )+refresh-preview" \
--bind "ctrl-s:execute-silent( gsed 's/^VIEW=.*/VIEW=preview_opshow/' -i $TEMPD/oplog.env )+refresh-preview" \
--bind "alt-r:execute( $SELF op-restore {} )+abort" \
--bind "alt-w:execute( $SELF restore-commit {} )+abort" \
--bind "alt-y:execute( $SELF undo-op {} )+$RELOAD" \
Expand Down

0 comments on commit c2b327a

Please sign in to comment.