Skip to content

Commit

Permalink
jj-fzf: op log: Ctrl-S: Preview "@" at a specific operation via `jj s…
Browse files Browse the repository at this point in the history
…how @`

* Breaking: Use Ctrl-S (not Ctrl-D) in the op-log view to `jj show`
  the working copy commit of a specific operation.
* op log: Improved Ctrl-L and Ctrl-P docs.

Signed-off-by: Tim Janik <[email protected]>
  • Loading branch information
tim-janik committed Dec 9, 2024
1 parent cabc7af commit 88d412c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions jj-fzf
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ case "${1:-}" in
jj --no-pager --ignore-working-copy --at-op "${BASH_REMATCH[1]}" --color=always op log --no-graph -n 1 -T builtin_op_log_comfortable
jj --no-pager --ignore-working-copy --at-op "${BASH_REMATCH[1]}" --color=always log -r .. # -T builtin_log_oneline
} ; exit ;;
preview_opdiff)
preview_opshow)
[[ " ${2:-} " =~ $OPRPAT ]] && {
jj --no-pager --ignore-working-copy --at-op "${BASH_REMATCH[1]}" --color=always op log --no-graph -n 1 -T builtin_op_log_comfortable
jj --no-pager --ignore-working-copy --at-op "${BASH_REMATCH[1]}" --color=always log --no-graph -s -r "@"
jj --no-pager --ignore-working-copy --at-op "${BASH_REMATCH[1]}" --color=always show -T ' "\n" ' -r "@"
} ; exit ;;
preview_opshow)
[[ " ${2:-} " =~ ^[^a-z0-9]*([0-9a-f]{9,})\ ]] && {
preview_oppatch)
[[ " ${2:-} " =~ $OPRPAT ]] && {
jj --no-pager --ignore-working-copy --color=always op show -p "${BASH_REMATCH[1]}"
} ; exit ;;
esac
Expand Down Expand Up @@ -941,24 +941,24 @@ op-log()
temp_dir
echo > $TEMPD/oplog.env
H=$'\n'
H="$H"$'Ctrl-D: Preview diff of "@" at a specific operation\n'
H="$H"$'Ctrl-L: Preview history at a specific operation\n'
H="$H"$'Ctrl-P: Preview patch at a specific operation via `jj op show -p`\n'
H="$H"$'Ctrl-S: Preview "@" at a specific operation via `jj show @`\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"$'\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'
H="$H"$'Alt-Y: Undo/redo the selected operation entry\n'
H="$H"$'Alt-Z: Undo the next operation\n'
echo 'VIEW=preview_opshow' >> $TEMPD/oplog.env
echo 'VIEW=preview_oppatch' >> $TEMPD/oplog.env
export FZF_DEFAULT_COMMAND="$SELF op_log_oneline"
RELOAD='reload(eval "$FZF_DEFAULT_COMMAND")'
"${FZFPOPUP[@]}" \
--border-label '-[ OP-LOG ]-' --color=border:bright-yellow,label:bright-yellow \
--prompt "Operation > " \
--header "$H" --header-first \
--bind "ctrl-d:execute-silent( gsed 's/^VIEW=.*/VIEW=preview_opdiff/' -i $TEMPD/oplog.env )+refresh-preview" \
--bind "ctrl-s:execute-silent( gsed 's/^VIEW=.*/VIEW=preview_opshow/' -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_opshow/' -i $TEMPD/oplog.env )+refresh-preview" \
--bind "ctrl-p:execute-silent( gsed 's/^VIEW=.*/VIEW=preview_oppatch/' -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 88d412c

Please sign in to comment.