chore(jj): add closest bookmark and tug

Amolith created

Change summary

dot_config/private_jj/config.toml.tmpl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Detailed changes

dot_config/private_jj/config.toml.tmpl 🔗

@@ -28,7 +28,11 @@ allowed-signers = "/home/amolith/.ssh/allowed_signers"
 sign-on-push = false
 {{- end }}
 
+[revset-aliases]
+'closest_bookmark(to)' = 'heads(::to & bookmarks())'
+
 [aliases]
+tug = ["bookmark", "move", "--from", "closest_bookmark(@-)", "--to", "@-"]
 {{- if ne .chezmoi.username "exedev" }}
 # Use `jj push` (this alias), not `jj git push`.
 # It signs only our own mutable unsigned commits in the push range, then pushes.
@@ -61,7 +65,7 @@ if [ -z "$remote" ]; then
   remote="origin"
 fi
 
-jj sign -r "mine() & mutable() & ~signed() & (remote_bookmarks(remote=${remote})..@)"
+jj sign -r "mine() & mutable() & ~signed() & (remote_bookmarks(remote=${remote})..closest_bookmark(@))"
 jj git push "$@"
 """, ""]
 {{- end }}