Skip to content

Instantly share code, notes, and snippets.

@thoughtpolice
Last active October 23, 2024 14:46
Show Gist options
  • Save thoughtpolice/8f2fd36ae17cd11b8e7bd93a70e31ad6 to your computer and use it in GitHub Desktop.
Save thoughtpolice/8f2fd36ae17cd11b8e7bd93a70e31ad6 to your computer and use it in GitHub Desktop.
my jujutsu config
#!/usr/bin/env bash
set -euo pipefail
NAME=$(jj config get user.name)
MAIL=$(jj config get user.email)
SIGNSTR="Signed-off-by: ${NAME} <${MAIL}>"
contents=$(<"$1")
readarray -t lines <<<"$contents"
body=''
last=''
for x in "${lines[@]}"; do
[[ "$x" =~ ^"JJ:" ]] && continue
[[ "$x" =~ ^"$SIGNSTR" ]] && continue
[[ "$x" == '' ]] && [[ "$last" == '' ]] && continue
last="$x"
body+="$x\n"
done
body+="$SIGNSTR\n"
t=$(mktemp)
printf "$body" > "$t"
mv "$t" "$1"
exec hx "$1"
[user]
name = "Austin Seipp"
email = "[email protected]"
[core]
#fsmonitor = "watchman"
[format]
tree-level-conflicts = true
[git]
# https://github.com/martinvonz/jj/blob/main/docs/config.md#automatic-local-branch-creation
auto-local-branch = false
push-branch-prefix = "aseipp/push-"
[merge-tools.difft]
diff-args = ["--color=always", "$left", "$right"]
[ui]
pager = { command = [ "less", "-FRX"], env = { LESSCHARSET = "utf-8" } }
default-command = "log"
diff.tool = "difft"
diff-editor = "diffedit3"
log-synthetic-elided-nodes = true
graph.style = "square"
allow-filesets = true
[templates]
op_log_node = 'if(current_operation, "@", "◉")'
log_node = '''
label("node",
coalesce(
if(!self, label("elided", "⇋")),
if(current_working_copy, label("working_copy", "◉")),
if(conflict, label("conflict", "x")),
if(immutable, label("immutable", "◆")),
if(description.starts_with("wip: "), label("wip", "!")),
label("normal", "○")
)
)
'''
[colors]
"node" = { bold = true }
"node elided" = { fg = "bright black" }
"node working_copy" = { fg = "green" }
"node conflict" = { fg = "red" }
"node immutable" = { fg = "bright cyan" }
"node wip" = { fg = "yellow" }
"node normal" = { bold = false }
"normal change_id" = { bold = true, fg = "magenta" }
"immutable change_id" = { bold = false, fg = "bright cyan" }
[template-aliases]
#'format_short_change_id(id)' = '''
#coalesce(
# if(immutable, label("immutable", id.shortest(2) ++ " ⇜ ")),
# label("normal", id.shortest(2) ++ " ⇜ ")
#)
#'''
'format_short_signature(signature)' = '"<" ++ signature.email() ++ ">"'
'format_timestamp(ts)' = '"[" ++ ts.ago() ++ "]"'
[aliases]
signoff = [ "--config-toml=ui.editor='/home/austin/.jj-signoff.sh'", "commit" ]
d = [ "diff" ]
s = [ "show", "--tool", "difft" ]
h = [ "help" ]
ws = [ "workspace" ]
ll = [ "log", "-T", "builtin_log_detailed" ]
goto = [ "edit" ]
sl = ["log", "-r", "(trunk()..@):: | (trunk()..@)-"]
retrunk = [ "rebase", "-d", "trunk()" ]
bl = ["branch", "list"]
gh-push = [ "git", "push", "--remote", "gh" ]
open = [ "log", "-r", "open()" ]
nom = [ "squash", "--into", "@", "--from" ]
yeet = [ "squash", "--from", "@", "--into" ]
[revset-aliases]
"at" = "@"
'immutable_heads()' = 'trunk() | remote_branches() | tags()'
'trunk()' = 'latest((present(main) | present(master)) & remote_branches())'
'user(x)' = 'author(x) | committer(x)'
'open()' = '(mine() ~ ::trunk()) ~ heads(empty())'
'gh-pages' = 'ancestors(remote_branches(exact:"gh-pages"))'
'wip' = 'description("wip: ")'
'ready' = 'open() ~ (wip::)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment