my nix dotfiles

programs/jujutsu: new config

Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>

authored by anirudh.fi and committed by anirudh.fi c43799cc e99825cb

+111 -18
+111 -18
programs/jujutsu.nix
··· 8 8 settings = { 9 9 user = { 10 10 name = "Anirudh Oppiliappan"; 11 - email = "x@icyphox.sh"; 11 + email = "anirudh@tangled.sh"; 12 + }; 13 + ui = { 14 + # paginate = "never"; 15 + default-command = "log"; 16 + pager = "${pkgs.delta}/bin/delta"; 17 + diff.format = "git"; 18 + graph.style = "curved"; 19 + should-sign-off = true; 12 20 }; 13 - 14 21 signing = { 15 22 behavior = "own"; 16 23 backend = "ssh"; 17 24 key = "~/.ssh/id_ed25519.pub"; 18 25 }; 19 26 20 - git.sign-on-push = true; 21 - git.write-change-id-header = true; 22 - 27 + colors = { 28 + commit_id = "magenta"; 29 + change_id = "cyan"; 30 + "working_copy empty" = "green"; 31 + "working_copy placeholder" = "red"; 32 + "working_copy description placeholder" = "yellow"; 33 + "working_copy empty description placeholder" = "green"; 34 + prefix = { 35 + bold = true; 36 + fg = "cyan"; 37 + }; 38 + rest = { 39 + bold = false; 40 + fg = "bright black"; 41 + }; 42 + "node elided" = "yellow"; 43 + "node working_copy" = "green"; 44 + "node conflict" = "red"; 45 + "node immutable" = "red"; 46 + "node normal" = { bold = false; }; 47 + "node" = { bold = false; }; 48 + }; 49 + git = { 50 + sign-on-push = true; 51 + write-change-id-header = true; 52 + }; 23 53 aliases = { 54 + d = [ "diff" ]; 55 + l = [ "log" ]; 56 + ll = [ "log" "-r" ".." ]; 24 57 tug = [ "bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@-" ]; 25 58 }; 26 - 27 - ui.paginate = "never"; 28 - ui.default-command = [ "log" "-n" "10" ]; 59 + revsets = { 60 + log = "current_work"; 61 + }; 62 + revset-aliases = { 63 + "stack()" = "ancestors(reachable(@, mutable()), 2)"; 64 + "stack(x)" = "ancestors(reachable(x, mutable()), 2)"; 65 + "stack(x, n)" = "ancestors(reachable(x, mutable()), n)"; 66 + "current_work" = "trunk()..@ | @..trunk() | trunk() | @:: | fork_point(trunk() | @)"; 67 + }; 29 68 template-aliases = { 30 - custom_log_compact = '' 69 + "format_short_id(id)" = "id.shortest()"; 70 + "abbreviate_timestamp_suffix(s, suffix, abbr)" = '' 71 + if( 72 + s.ends_with(suffix), 73 + s.remove_suffix(suffix) ++ label("timestamp", abbr) 74 + ) 75 + ''; 76 + "abbreviate_relative_timestamp(s)" = '' 77 + coalesce( 78 + abbreviate_timestamp_suffix(s, " millisecond", "ms"), 79 + abbreviate_timestamp_suffix(s, " second", "s"), 80 + abbreviate_timestamp_suffix(s, " minute", "m"), 81 + abbreviate_timestamp_suffix(s, " hour", "h"), 82 + abbreviate_timestamp_suffix(s, " day", "d"), 83 + abbreviate_timestamp_suffix(s, " week", "w"), 84 + abbreviate_timestamp_suffix(s, " month", "mo"), 85 + abbreviate_timestamp_suffix(s, " year", "y"), 86 + s 87 + ) 88 + ''; 89 + "format_timestamp(timestamp)" = '' 90 + coalesce( 91 + if(timestamp.after("1 minute ago"), label("timestamp", "<=1m")), 92 + abbreviate_relative_timestamp(timestamp.ago().remove_suffix(' ago').remove_suffix('s')) 93 + ) 94 + ''; 95 + }; 96 + templates = { 97 + log = '' 31 98 if(root, 32 99 format_root_commit(self), 33 100 label(if(current_working_copy, "working_copy"), 34 101 concat( 35 102 separate(" ", 36 - format_short_change_id_with_hidden_and_divergent_info(self), 37 - author.name(), 38 - bookmarks, 39 - tags, 40 - working_copies, 41 - if(conflict, label("conflict", "conflict")), 103 + pad_end(4, format_short_change_id_with_hidden_and_divergent_info(self)), 42 104 if(empty, label("empty", "(empty)")), 43 105 if(description, 44 106 description.first_line(), 45 107 label(if(empty, "empty"), description_placeholder), 46 108 ), 109 + bookmarks, 110 + tags, 111 + working_copies, 112 + if(git_head, label("git_head", "HEAD")), 113 + if(conflict, label("conflict", "conflict")), 114 + if(config("ui.show-cryptographic-signatures").as_boolean(), 115 + format_short_cryptographic_signature(signature)), 116 + format_timestamp(commit_timestamp(self)), 47 117 ) ++ "\n", 48 118 ), 49 119 ) 50 120 ) 51 121 ''; 52 - }; 122 + log_node = '' 123 + label("node", 124 + coalesce( 125 + if(!self, label("elided", "~")), 126 + if(current_working_copy, label("working_copy", "@")), 127 + if(conflict, label("conflict", "×")), 53 128 54 - templates = { 55 - log = "custom_log_compact"; 129 + if(immutable, label("immutable", "*")), 130 + label("normal", "·") 131 + ) 132 + ) 133 + ''; 134 + draft_commit_description = '' 135 + concat( 136 + coalesce(description, default_commit_description, "\n"), 137 + if( 138 + config("ui.should-sign-off").as_boolean() && !description.contains("Signed-off-by: " ++ author.name()), 139 + "\nSigned-off-by: " ++ author.name() ++ " <" ++ author.email() ++ ">", 140 + ), 141 + surround( 142 + "\nJJ: This commit contains the following changes:\n", "", 143 + indent("JJ: ", diff.stat(72)), 144 + ), 145 + "\nJJ: ignore-rest\n", 146 + diff.git(), 147 + ) 148 + ''; 56 149 }; 57 150 }; 58 151 };