]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/jujutsu/jj/config.toml
+funct/appro(jujutsu): init jj and jjui configs
[julm/julm-nix.git] / home-manager / profiles / jujutsu / jj / config.toml
1 [aliases]
2 a = ["absorb"]
3 dlog = ["log", "-r"]
4 l = ["log", "-r", "(trunk()..@):: | (trunk()..@)-"]
5 #l = ["log", "-r", "more()"]
6 fresh = ["new", "trunk()"]
7 # Figures out the closest bookmark
8 # and pulls it up to the latest change that can be pushed.
9 tug = [
10 "bookmark",
11 "move",
12 "--from",
13 "closest_bookmark(@)",
14 "--to",
15 "closest_pushable(@)",
16 ]
17 bl = ["bookmark", "list"]
18 blr = ["bookmark", "list", "--revisions", "recent()"]
19 c = ["commit"]
20 ci = ["commit", "--interactive"] # commit interactive
21 m = ["describe"]
22 mm = ["describe", "--message"]
23 d = ["diff", "--stat", "--revisions"]
24 dd = ["diff", "--revisions"]
25 dp = ["describe", "@-"] # describe previous
26 e = ["edit"]
27 para = [ "parallelize", "closest_tip()..@-" ]
28 pull = ["git", "fetch"]
29 push = ["git", "push"]
30 gf = ["git", "fetch"] # git fetchq
31 gi = ["git", "init", "--colocate"]
32 gp = ["git", "push"] # git push
33 i = ["git", "init", "--colocate"]
34 nb = ["bookmark", "create", "-r @-"] # new bookmark (for creating bookmark to push)
35 nc = ["new", "-B", "@", "--no-edit"] # new change before
36 r = ["rebase"]
37 rm = ["rebase", "-d", "main"] # "re-main"
38 s = ["show", "--stat"]
39 ss = ["show"]
40 sq = ["squash"]
41 sqi = ["squash", "--interactive"]
42 si = ["squash", "--interactive"]
43 sp = ["show", "@-"]
44 up = ["util", "exec", "--", "sh", "-c", """
45 if [ $# == 0 ]; then
46 jj bookmark move --from "closest_bookmark(@)" --to "closest_pushable(@)"
47 else
48 jj bookmark move --to "closest_pushable(@)" "$@"
49 fi
50 """, ""]
51 upp = ["util", "exec", "--", "sh", "-c", "jj up && jj git push", ""]
52
53
54 # Get all open stacks of work.
55 open = ["log", "-r", "open()"]
56
57 # Better name, IMO.
58 credit = ["file", "annotate"]
59
60 # Retrunk a series. Typically used as `jj retrunk -s ...`, and notably can be
61 # used with open:
62 # - jj retrunk -s 'all:roots(open())'
63 retrunk = ["rebase", "-d", "trunk()"]
64
65 # Retrunk the current stack of work.
66 reheat = ["rebase", "-d", "trunk()", "-s", "all:roots(trunk()..stack(@))"]
67
68 # Take content from any change, and move it into @.
69 # - jj consume xyz path/to/file`
70 consume = ["squash", "--into", "@", "--from"]
71
72 # Eject content from @ into any other change.
73 # - jj eject xyz --interactive
74 eject = ["squash", "--from", "@", "--into"]
75
76
77 # All operations
78 o = ["op", "log"]
79 # All operations, with more whitespace
80 oo = ["op", "log", "-T", "builtin_op_log_comfortable"]
81
82 abandon-empties = ["abandon", "-r", "description(exact:'') ~ root()"]
83
84 # Move $commit just after the bookmark, and then move $bookmark on top of it.
85 #
86 # "$bookmark+" works, because after rebase -A, the only child of $bookmark is $commit.
87 # I do not use $commit itself because it might point to a
88 # different commit after the rebase (e.g. @-).
89 #
90 # My workflow uses mega-merge: I write a commit or two,
91 # and then move them to relevant branches with jj to.
92 # As a bonus, bookmarks are kept up-to-date for easy pushing.
93 # https://github.com/jj-vcs/jj/discussions/5568#discussioncomment-14289564
94 to = ['util', 'exec', '--', 'sh', '-c', '''
95 set -eux
96
97 bookmark=$1
98 commit=${2-}
99
100 # default to latest non-ephemeral commit
101 if [ -z "$commit" ]; then
102 commit=$(jj log --no-graph -T change_id -r '@ ~ ephemeral')
103 if [ -n "$commit" ]; then
104 # Moving current commit, create a new one to preserve
105 # current position in the commit DAG
106 jj new
107 else
108 commit=@-
109 fi
110 fi
111
112 jj rebase -r "$commit" -A "$bookmark"
113 jj bookmark move -f "$bookmark" -t "$bookmark+"
114 ''', 'jj-to']
115
116 [revsets]
117 log = "@ | trunk()::visible_heads()"
118
119 [revset-aliases]
120 "active(rev)" = "(ancestors(rev) | descendants(rev)) ~ immutable()"
121
122 # Authored or committed by specified user
123 'user(x)' = 'author(x) | committer(x)'
124
125 'closest_tip()' = 'heads(::@ & remote_bookmarks())'
126
127 # Those who would be abandoned if you check out something else
128 ephemeral = 'description(exact:"") & empty()'
129
130 # show everything in the current set of branches off of trunk():
131 branch = '(coalesce(trunk(),root())..@)- | (coalesce(trunk(),root())..@)::'
132
133 # radicle
134 'closest_bookmark(to)' = 'heads(::to & bookmarks())'
135 'closest_pushable(to)' = 'heads(::to & mutable() & ~description(exact:"") & (~empty() | merges()))'
136
137 "desc(x)" = "description(x)"
138 "pending()" = ".. ~ ::tags() ~ ::remote_bookmarks() ~ @ ~ private()"
139 "private()" = "description(glob:'wip:*') | description(glob:'private:*') | description(glob:'WIP:*') | description(glob:'PRIVATE:*') | conflicts() | (empty() ~ merges()) | description('substring-i:\"DO NOT MAIL\"')"
140 #"trunk()" = "main@rad"
141 #"immutable_heads()" = "tags()"
142 "immutable_heads()" = "present(trunk()) | tags() | ( untracked_remote_bookmarks() ~ untracked_remote_bookmarks(remote='rad') ~ untracked_remote_bookmarks(regex:'^patch(es)/',remote='rad'))"
143 #'default()' = 'coalesce(trunk(), root())::present(@) | ancestors(visible_heads(), 2)'
144
145 # dev
146 'bases' = 'present(main@rad) | present(master@origin) | present(main@origin)'
147 'downstream(x,y)' = '(x::y) & y'
148 'branches' = 'downstream(trunk(), bookmarks()) & mine()'
149 'branchesandheads' = 'branches | (heads(trunk()::) & mine())'
150 'curbranch' = 'latest(branches::@- & branches)'
151 'nextbranch' = 'roots(@:: & branchesandheads)'
152
153 'more' = 'log | ancestors(visible_heads(), 2)'
154 'unmerged()' = 'bookmarks() & ~(trunk():: | trunk())'
155 'recent()' = 'committer_date(after:"1 months ago")'
156 'recent(revset)' = 'revset & recent()'
157
158
159 # stack(x, n) is the set of mutable commits reachable from 'x', with 'n'
160 # parents. 'n' is often useful to customize the display and return set for
161 # certain operations. 'x' can be used to target the set of 'roots' to traverse,
162 # e.g. @ is the current stack.
163 'stack()' = 'ancestors(reachable(@, mutable()), 2)'
164 'stack(x)' = 'ancestors(reachable(x, mutable()), 2)'
165 'stack(x, n)' = 'ancestors(reachable(x, mutable()), n)'
166
167 # The current set of "open" works. It is defined as:
168 #
169 # - given the set of commits not in trunk, that are written by me,
170 # - calculate the given stack() for each of those commits
171 #
172 # n = 1, meaning that nothing from `trunk()` is included, so all resulting
173 # commits are mutable by definition.
174 'open()' = 'stack(trunk().. & mine(), 1)'
175
176 # the set of 'ready()' commits. defined as the set of open commits, but nothing
177 # that is blacklisted or any of their children.
178 #
179 # often used with gerrit, which you can use to submit whole stacks at once:
180 #
181 # - jj gerrit send -r 'ready()' --dry-run
182 'ready()' = 'open() ~ blacklist()::'
183
184 [template-aliases]
185 # Hide unnecessary bits to make the jj log more concise
186 #'format_short_change_id(id)' = 'id.shortest(4)'
187 #'format_short_commit_id(id)' = 'id.shortest(4)'
188 'format_timestamp(timestamp)' = 'timestamp.ago()'
189
190 #'format_short_signature(signature)' = 'signature.email()'
191 # Both name and email address
192 #'format_short_signature(signature)' = 'signature'
193 # Username part of the email address
194 #'format_short_signature(signature)' = 'signature.email().local()'
195 'format_short_signature(signature)' = 'signature.name()'
196
197
198 [git]
199 write-change-id-header = true
200 # Prevent pushing work in progress or anything explicitly labeled "private"
201 private-commits = "description(glob:'wip:*') | description(glob:'private:*')"
202 # Don't require --allow-new when pushing a new bookmark
203 push-new-bookmarks = true
204 fetch = ["origin", "rad"]
205 push = "origin"
206
207
208 [user]
209 name = "Julien Moutinho"
210 email = "julm@sourcephile.fr"
211
212 [ui]
213 paginate = "auto"
214 default-command = "log"
215 diff-editor = ":builtin"
216 # From https://github.com/julienvincent/hunk.nvim
217 #diff-editor = ["nvim", "-c", "DiffEditor $left $right $output"]
218
219 [merge-tools.diffconflicts]
220 program = "nvim"
221 merge-args = [
222 "-c", "let g:jj_diffconflicts_marker_length=$marker_length",
223 "-c", "JJDiffConflicts!", "$output", "$base", "$left", "$right",
224 ]
225 merge-tool-edits-conflict-markers = true
226
227 # # via @dubi steinkek in the jj discord
228 # [merge-tools.gitpatch]
229 # program = "sh"
230 # edit-args = ["-c", '''
231 # set -eu
232 # rm -f "$right/JJ-INSTRUCTIONS"
233 # git -C "$left" init -q
234 # git -C "$left" add -A
235 # git -C "$left" commit -q -m baseline --allow-empty
236 # mv "$left/.git" "$right"
237 # git -C "$right" add --intent-to-add --ignore-removal . # tell git to include new files in interactive patch mode
238 # git -C "$right" add -p
239 # git -C "$right" diff-index --quiet --cached HEAD && { echo "No changes done, aborting split."; exit 1; }
240 # git -C "$right" commit -q -m split
241 # git -C "$right" reset -q --hard # undo changes in modified files, remove added files
242 # ''',
243 # ]
244 # merge-args = ["-c", "echo gitpatch cannot be used as a diff tool"]
245 # diff-args = ["-c", "echo gitpatch cannot be used as a diff tool"]