feat(sapling): move log template into the config and add switch alias

When running other log command the template I had setup in `sl` was not
getting used. This has now been put into the config so its the default
template for any log command.

This also adds a quick alias to switch to another head. When reviewing
pull requests locally this helps quickly switch between heads.
This commit is contained in:
Ade Attwood 2024-03-02 18:08:43 +00:00
parent 5c87f2271b
commit 73ecb1604d
2 changed files with 5 additions and 1 deletions

View file

@ -1,10 +1,12 @@
# Alias sl to s. This is so we can keep the workflow much the same as git. You
# can mostly replace `g` with `s` and you are using sapling instead of git.
alias s="\\sl"
alias sl="\\sl log --pager never --remote -T ' {graphnode} {ifeq(phase, \"public\", \"\\033[31m\", \"\\033[34m\")}{node|short}\\033[0m {truncatelonglines(desc|firstline, 80)} \\033[32m({date|age}) \\033[34;1m<{author|person}> {if(github_pull_request_number, \"\033[31mPR #{github_pull_request_number}\")}\\033[0m\n' -r '.::top() or last(::., 40)'"
alias sl="\\sl log --pager never --remote -r '.::top() or last(::., 40)'"
alias sc="\\sl commit -iv"
alias sd="\\sl diff"
alias ss="\\sl status"
alias sco="\\sl log -r 'heads(draft())' -T'{node} {truncatelonglines(desc|firstline, 80)} <{author|person}>\n' | fzf | cut -d' ' -f1 | xargs \\sl goto"
function sl-convert() {
if ! [ -d .git ]; then

View file

@ -19,6 +19,8 @@ color = never
# (see 'sl help pager' for details)
#paginate = always
logtemplate = ' {graphnode} {ifeq(phase, "public", "\033[31m", "\033[34m")}{node|short}\033[0m {truncatelonglines(desc|firstline, 80)} \033[32m({date|age}) \033[34;1m<{author|person}>{if(github_pull_request_number, " \033[31mPR #{github_pull_request_number}")}\033[0m{if(bookmarks, " [{bookmarks}]")}\n'
# User delta as the pager so that the diff is highlighted nicely.in the
# terminal. This give a better diff coloring than the built in sl pager, also
# keeps things looking the same as git so I can keep the familiarity when