Skip to content

Commit f369749

Browse files
committed
log node template: mark empty un-conflicted commits with
This is useful to see which merges resolve conflicts and to more easily sort WIP commits. Some ideas I thought about and decided against: - `∅` looked too messy - I considered using green for "empty", and yellow for "non-empty working copy", but I think the dotted circle is visible enough and making the working copy stand out is more important. - There's the option of using `○` for empty commits and `●` for non-empty, but I personally feel like so many `●`s would look too heavy.
1 parent a83dadd commit f369749

27 files changed

+1098
-1097
lines changed

cli/src/config/templates.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ coalesce(
228228
if(current_working_copy, "@"),
229229
if(immutable, "◆"),
230230
if(conflict, "×"),
231+
if(empty, "◌"),
231232
"○",
232233
)
233234
)

cli/tests/test_advance_branches.rs

Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,23 @@ fn test_advance_branches_enabled(make_commit: CommitFn) {
8484
// Run jj commit, which will advance the branch pointing to @-.
8585
make_commit(&test_env, &workspace_path, "first");
8686
insta::allow_duplicates! {
87-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
87+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
8888
@ branches{} desc:
89-
branches{test_branch} desc: first
89+
branches{test_branch} desc: first
9090
◆ branches{} desc:
91-
"###);
91+
"#);
9292
}
9393

9494
// Now disable advance branches and commit again. The branch shouldn't move.
9595
set_advance_branches(&test_env, false);
9696
make_commit(&test_env, &workspace_path, "second");
9797
insta::allow_duplicates! {
98-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
98+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
9999
@ branches{} desc:
100-
branches{} desc: second
101-
branches{test_branch} desc: first
100+
branches{} desc: second
101+
branches{test_branch} desc: first
102102
◆ branches{} desc:
103-
"###);
103+
"#);
104104
}
105105
}
106106

@@ -125,24 +125,24 @@ fn test_advance_branches_at_minus(make_commit: CommitFn) {
125125

126126
make_commit(&test_env, &workspace_path, "first");
127127
insta::allow_duplicates! {
128-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
128+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
129129
@ branches{} desc:
130-
branches{test_branch} desc: first
130+
branches{test_branch} desc: first
131131
◆ branches{} desc:
132-
"###);
132+
"#);
133133
}
134134

135135
// Create a second branch pointing to @. On the next commit, only the first
136136
// branch, which points to @-, will advance.
137137
test_env.jj_cmd_ok(&workspace_path, &["branch", "create", "test_branch2"]);
138138
make_commit(&test_env, &workspace_path, "second");
139139
insta::allow_duplicates! {
140-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
140+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
141141
@ branches{} desc:
142-
branches{test_branch test_branch2} desc: second
143-
branches{} desc: first
142+
branches{test_branch test_branch2} desc: second
143+
branches{} desc: first
144144
◆ branches{} desc:
145-
"###);
145+
"#);
146146
}
147147
}
148148

@@ -172,11 +172,11 @@ fn test_advance_branches_overrides(make_commit: CommitFn) {
172172
// Commit will not advance the branch since advance-branches is disabled.
173173
make_commit(&test_env, &workspace_path, "first");
174174
insta::allow_duplicates! {
175-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
175+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
176176
@ branches{} desc:
177-
branches{} desc: first
177+
branches{} desc: first
178178
◆ branches{test_branch} desc:
179-
"###);
179+
"#);
180180
}
181181

182182
// Now enable advance branches for "test_branch", move the branch, and commit
@@ -191,20 +191,20 @@ fn test_advance_branches_overrides(make_commit: CommitFn) {
191191
&["branch", "set", "test_branch", "-r", "@-"],
192192
);
193193
insta::allow_duplicates! {
194-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
194+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
195195
@ branches{} desc:
196-
branches{test_branch} desc: first
196+
branches{test_branch} desc: first
197197
◆ branches{} desc:
198-
"###);
198+
"#);
199199
}
200200
make_commit(&test_env, &workspace_path, "second");
201201
insta::allow_duplicates! {
202-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
202+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
203203
@ branches{} desc:
204-
branches{test_branch} desc: second
205-
branches{} desc: first
204+
branches{test_branch} desc: second
205+
branches{} desc: first
206206
◆ branches{} desc:
207-
"###);
207+
"#);
208208
}
209209

210210
// Now disable advance branches for "test_branch" and "second_branch", which
@@ -217,13 +217,13 @@ fn test_advance_branches_overrides(make_commit: CommitFn) {
217217
);
218218
make_commit(&test_env, &workspace_path, "third");
219219
insta::allow_duplicates! {
220-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
220+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
221221
@ branches{} desc:
222-
branches{} desc: third
223-
branches{test_branch} desc: second
224-
branches{} desc: first
222+
branches{} desc: third
223+
branches{test_branch} desc: second
224+
branches{} desc: first
225225
◆ branches{} desc:
226-
"###);
226+
"#);
227227
}
228228

229229
// If we create a new branch at @- and move test_branch there as well. When
@@ -237,24 +237,24 @@ fn test_advance_branches_overrides(make_commit: CommitFn) {
237237
&["branch", "set", "test_branch", "-r", "@-"],
238238
);
239239
insta::allow_duplicates! {
240-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
240+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
241241
@ branches{} desc:
242-
branches{second_branch test_branch} desc: third
243-
branches{} desc: second
244-
branches{} desc: first
242+
branches{second_branch test_branch} desc: third
243+
branches{} desc: second
244+
branches{} desc: first
245245
◆ branches{} desc:
246-
"###);
246+
"#);
247247
}
248248
make_commit(&test_env, &workspace_path, "fourth");
249249
insta::allow_duplicates! {
250-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
250+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
251251
@ branches{} desc:
252-
branches{second_branch} desc: fourth
253-
branches{test_branch} desc: third
254-
branches{} desc: second
255-
branches{} desc: first
252+
branches{second_branch} desc: fourth
253+
branches{test_branch} desc: third
254+
branches{} desc: second
255+
branches{} desc: first
256256
◆ branches{} desc:
257-
"###);
257+
"#);
258258
}
259259
}
260260

@@ -287,11 +287,11 @@ fn test_advance_branches_multiple_branches(make_commit: CommitFn) {
287287
// Both branches are eligible and both will advance.
288288
make_commit(&test_env, &workspace_path, "first");
289289
insta::allow_duplicates! {
290-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
290+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
291291
@ branches{} desc:
292-
branches{first_branch second_branch} desc: first
292+
branches{first_branch second_branch} desc: first
293293
◆ branches{} desc:
294-
"###);
294+
"#);
295295
}
296296
}
297297

@@ -319,23 +319,23 @@ fn test_new_advance_branches_interior() {
319319
&workspace_path,
320320
&["branch", "create", "-r", "@---", "test_branch"],
321321
);
322-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
322+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
323323
@ branches{} desc:
324-
branches{} desc: third
325-
branches{} desc: second
326-
branches{test_branch} desc: first
324+
branches{} desc: third
325+
branches{} desc: second
326+
branches{test_branch} desc: first
327327
◆ branches{} desc:
328-
"###);
328+
"#);
329329

330330
test_env.jj_cmd_ok(&workspace_path, &["new", "-r", "@--"]);
331-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
331+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
332332
@ branches{} desc:
333-
branches{} desc: third
333+
branches{} desc: third
334334
├─╯
335-
branches{test_branch} desc: second
336-
branches{} desc: first
335+
branches{test_branch} desc: second
336+
branches{} desc: first
337337
◆ branches{} desc:
338-
"###);
338+
"#);
339339
}
340340

341341
// If the `--before` flag is passed to `jj new`, branches are not advanced.
@@ -361,22 +361,22 @@ fn test_new_advance_branches_before() {
361361
&workspace_path,
362362
&["branch", "create", "-r", "@---", "test_branch"],
363363
);
364-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
364+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
365365
@ branches{} desc:
366-
branches{} desc: third
367-
branches{} desc: second
368-
branches{test_branch} desc: first
366+
branches{} desc: third
367+
branches{} desc: second
368+
branches{test_branch} desc: first
369369
◆ branches{} desc:
370-
"###);
370+
"#);
371371

372372
test_env.jj_cmd_ok(&workspace_path, &["new", "--before", "@-"]);
373-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
374-
branches{} desc: third
373+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
374+
branches{} desc: third
375375
@ branches{} desc:
376-
branches{} desc: second
377-
branches{test_branch} desc: first
376+
branches{} desc: second
377+
branches{test_branch} desc: first
378378
◆ branches{} desc:
379-
"###);
379+
"#);
380380
}
381381

382382
// If the `--after` flag is passed to `jj new`, branches are not advanced.
@@ -400,11 +400,11 @@ fn test_new_advance_branches_after() {
400400

401401
test_env.jj_cmd_ok(&workspace_path, &["describe", "-m", "first"]);
402402
test_env.jj_cmd_ok(&workspace_path, &["new", "--after", "@"]);
403-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
403+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
404404
@ branches{} desc:
405-
branches{} desc: first
405+
branches{} desc: first
406406
◆ branches{test_branch} desc:
407-
"###);
407+
"#);
408408
}
409409

410410
#[test]
@@ -423,26 +423,26 @@ fn test_new_advance_branches_merge_children() {
423423
);
424424

425425
// Check the initial state of the repo.
426-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
426+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
427427
@ branches{} desc: 2
428-
branches{} desc: 1
428+
branches{} desc: 1
429429
├─╯
430-
branches{test_branch} desc: 0
430+
branches{test_branch} desc: 0
431431
◆ branches{} desc:
432-
"###);
432+
"#);
433433

434434
// The branch won't advance because `jj new` had multiple targets.
435435
test_env.jj_cmd_ok(
436436
&workspace_path,
437437
&["new", "description(1)", "description(2)"],
438438
);
439-
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r###"
439+
insta::assert_snapshot!(get_log_output_with_branches(&test_env, &workspace_path), @r#"
440440
@ branches{} desc:
441441
├─╮
442-
branches{} desc: 2
443-
│ branches{} desc: 1
442+
branches{} desc: 2
443+
│ branches{} desc: 1
444444
├─╯
445-
branches{test_branch} desc: 0
445+
branches{test_branch} desc: 0
446446
◆ branches{} desc:
447-
"###);
447+
"#);
448448
}

cli/tests/test_backout_command.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,21 @@ fn test_backout_multiple() {
109109
create_commit(&test_env, &repo_path, "e", &["d"], &[("a", "a\nb\nc\n")]);
110110

111111
// Test the setup
112-
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
112+
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
113113
@ 208f8612074a e
114-
ceeec03be46b d
114+
ceeec03be46b d
115115
○ 413337bbd11f c
116116
○ 46cc97af6802 b
117117
○ 2443ea76b0b1 a
118118
◆ 000000000000
119-
"###);
119+
"#);
120120

121121
// Backout multiple commits
122122
let (stdout, stderr) =
123123
test_env.jj_cmd_ok(&repo_path, &["backout", "-r", "b", "-r", "c", "-r", "e"]);
124124
insta::assert_snapshot!(stdout, @"");
125125
insta::assert_snapshot!(stderr, @"");
126-
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
126+
insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#"
127127
○ 6504c4ded177 Back out "b"
128128
129129
│ This backs out commit 46cc97af6802301d8db381386e8485ff3ff24ae6.
@@ -134,12 +134,12 @@ fn test_backout_multiple() {
134134
135135
│ This backs out commit 208f8612074af4c219d06568a8e1f04f2e80dc25.
136136
@ 208f8612074a e
137-
ceeec03be46b d
137+
ceeec03be46b d
138138
○ 413337bbd11f c
139139
○ 46cc97af6802 b
140140
○ 2443ea76b0b1 a
141141
◆ 000000000000
142-
"###);
142+
"#);
143143
// View the output of each backed out commit
144144
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "@+"]);
145145
insta::assert_snapshot!(stdout, @r###"

0 commit comments

Comments
 (0)