]> 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 = "@ | bases | branches | curbranch::@ | @::nextbranch | downstream(@, branchesandheads)"
118
119 [revset-aliases]
120 # Authored or committed by specified user
121 'user(x)' = 'author(x) | committer(x)'
122
123 'closest_tip()' = 'heads(::@ & remote_bookmarks())'
124
125 # Those who would be abandoned if you check out something else
126 ephemeral = 'description(exact:"") & empty()'
127
128 # show everything in the current set of branches off of trunk():
129 branch = '(coalesce(trunk(),root())..@)- | (coalesce(trunk(),root())..@)::'
130
131 # radicle
132 'closest_bookmark(to)' = 'heads(::to & bookmarks())'
133 'closest_pushable(to)' = 'heads(::to & mutable() & ~description(exact:"") & (~empty() | merges()))'
134
135 "desc(x)" = "description(x)"
136 "pending()" = ".. ~ ::tags() ~ ::remote_bookmarks() ~ @ ~ private()"
137 "private()" = "description(glob:'wip:*') | description(glob:'private:*') | description(glob:'WIP:*') | description(glob:'PRIVATE:*') | conflicts() | (empty() ~ merges()) | description('substring-i:\"DO NOT MAIL\"')"
138 #"trunk()" = "main@rad"
139 #"immutable_heads()" = "tags()"
140 "immutable_heads()" = "present(trunk()) | tags() | ( untracked_remote_bookmarks() ~ untracked_remote_bookmarks(remote='rad') ~ untracked_remote_bookmarks(regex:'^patch(es)/',remote='rad'))"
141 #'default()' = 'coalesce(trunk(), root())::present(@) | ancestors(visible_heads(), 2)'
142
143 # dev
144 'bases' = 'present(main@rad) | present(master@origin) | present(main@origin)'
145 'downstream(x,y)' = '(x::y) & y'
146 'branches' = 'downstream(trunk(), bookmarks()) & mine()'
147 'branchesandheads' = 'branches | (heads(trunk()::) & mine())'
148 'curbranch' = 'latest(branches::@- & branches)'
149 'nextbranch' = 'roots(@:: & branchesandheads)'
150
151 'more' = 'log | ancestors(visible_heads(), 2)'
152 'unmerged()' = 'bookmarks() & ~(trunk():: | trunk())'
153 'recent()' = 'committer_date(after:"1 months ago")'
154 'recent(revset)' = 'revset & recent()'
155
156
157 # stack(x, n) is the set of mutable commits reachable from 'x', with 'n'
158 # parents. 'n' is often useful to customize the display and return set for
159 # certain operations. 'x' can be used to target the set of 'roots' to traverse,
160 # e.g. @ is the current stack.
161 'stack()' = 'ancestors(reachable(@, mutable()), 2)'
162 'stack(x)' = 'ancestors(reachable(x, mutable()), 2)'
163 'stack(x, n)' = 'ancestors(reachable(x, mutable()), n)'
164
165 # The current set of "open" works. It is defined as:
166 #
167 # - given the set of commits not in trunk, that are written by me,
168 # - calculate the given stack() for each of those commits
169 #
170 # n = 1, meaning that nothing from `trunk()` is included, so all resulting
171 # commits are mutable by definition.
172 'open()' = 'stack(trunk().. & mine(), 1)'
173
174 # the set of 'ready()' commits. defined as the set of open commits, but nothing
175 # that is blacklisted or any of their children.
176 #
177 # often used with gerrit, which you can use to submit whole stacks at once:
178 #
179 # - jj gerrit send -r 'ready()' --dry-run
180 'ready()' = 'open() ~ blacklist()::'
181
182 [template-aliases]
183 # Hide unnecessary bits to make the jj log more concise
184 #'format_short_change_id(id)' = 'id.shortest(4)'
185 #'format_short_commit_id(id)' = 'id.shortest(4)'
186 'format_timestamp(timestamp)' = 'timestamp.ago()'
187
188 #'format_short_signature(signature)' = 'signature.email()'
189 # Both name and email address
190 #'format_short_signature(signature)' = 'signature'
191 # Username part of the email address
192 #'format_short_signature(signature)' = 'signature.email().local()'
193 'format_short_signature(signature)' = 'signature.name()'
194
195
196 [git]
197 write-change-id-header = true
198 # Prevent pushing work in progress or anything explicitly labeled "private"
199 private-commits = "description(glob:'wip:*') | description(glob:'private:*')"
200 # Don't require --allow-new when pushing a new bookmark
201 push-new-bookmarks = true
202 fetch = ["origin", "rad"]
203 push = "origin"
204
205
206 [user]
207 name = "Julien Moutinho"
208 email = "julm@sourcephile.fr"
209
210 [ui]
211 paginate = "auto"
212 default-command = "log"
213 diff-editor = ":builtin"
214 # From https://github.com/julienvincent/hunk.nvim
215 #diff-editor = ["nvim", "-c", "DiffEditor $left $right $output"]
216
217 [merge-tools.diffconflicts]
218 program = "nvim"
219 merge-args = [
220 "-c", "let g:jj_diffconflicts_marker_length=$marker_length",
221 "-c", "JJDiffConflicts!", "$output", "$base", "$left", "$right",
222 ]
223 merge-tool-edits-conflict-markers = true
224
225 # # via @dubi steinkek in the jj discord
226 # [merge-tools.gitpatch]
227 # program = "sh"
228 # edit-args = ["-c", '''
229 # set -eu
230 # rm -f "$right/JJ-INSTRUCTIONS"
231 # git -C "$left" init -q
232 # git -C "$left" add -A
233 # git -C "$left" commit -q -m baseline --allow-empty
234 # mv "$left/.git" "$right"
235 # git -C "$right" add --intent-to-add --ignore-removal . # tell git to include new files in interactive patch mode
236 # git -C "$right" add -p
237 # git -C "$right" diff-index --quiet --cached HEAD && { echo "No changes done, aborting split."; exit 1; }
238 # git -C "$right" commit -q -m split
239 # git -C "$right" reset -q --hard # undo changes in modified files, remove added files
240 # ''',
241 # ]
242 # merge-args = ["-c", "echo gitpatch cannot be used as a diff tool"]
243 # diff-args = ["-c", "echo gitpatch cannot be used as a diff tool"]