feat(jujutsu): add timestamp.ago() to format #12

merged
opened by a.starrysky.fyi targeting main from private/minion/push-xqpmvvkspxvm

Timestamps currently display only the time, which is... fine, but can be somewhat annoying to see how long ago something actually was. It's possible to use timestamp.ago() to show how long ago a thing was as well. Let's add it to our default timestamp formatter so we can see that everywhere jujutsu shows us timestamps

Changed files
+41 -38
packetmix
homes
development
+41 -38
packetmix/homes/development/jujutsu.nix
··· 403 403 signingScriptScriptFSPath; 404 404 }; 405 405 snapshot.auto-track = "~(root-glob:'**/.envrc' | root-glob:'**/*.env' | root-glob:'**/.direnv/**/*')"; 406 - template-aliases.series_log = '' 407 - if(root, 408 - format_root_commit(self), 409 - label(if(current_working_copy, "working_copy"), 410 - concat( 411 - if(current_working_copy, label("op_log current_operation id", "@"), 412 - if(self.contained_in("..@"), label("diff added", "-"), 413 - label("diff removed", "+") 414 - )), 415 - " ", 416 - separate(" ", 417 - format_short_change_id_with_hidden_and_divergent_info(self), 418 - format_short_commit_id(commit_id), 419 - git_head, 420 - if(conflict, label("conflict", "conflict")), 421 - ) ++ " ", 422 - separate(" ", 423 - if(self.contained_in("@.."), 424 - label("rest", separate(" ", 425 - if(empty, "(empty)"), 426 - if(description, 427 - description.first_line(), 428 - "(no description set)", 429 - ), 430 - )), 431 - separate(" ", 432 - if(empty, label("empty", "(empty)")), 433 - if(description, 434 - description.first_line(), 435 - label(if(empty, "empty"), description_placeholder), 436 - ), 437 - ) 438 - ), 439 - if(!(current_working_copy || parents), "\033[22m") 440 - ) ++ "\n", 441 - ), 406 + template-aliases = { 407 + "format_timestamp(timestamp)" = ''timestamp.local().format("%Y-%m-%d %H:%M:%S") ++ " (" ++ timestamp.ago() ++ ")"''; 408 + series_log = '' 409 + if(root, 410 + format_root_commit(self), 411 + label(if(current_working_copy, "working_copy"), 412 + concat( 413 + if(current_working_copy, label("op_log current_operation id", "@"), 414 + if(self.contained_in("..@"), label("diff added", "-"), 415 + label("diff removed", "+") 416 + )), 417 + " ", 418 + separate(" ", 419 + format_short_change_id_with_hidden_and_divergent_info(self), 420 + format_short_commit_id(commit_id), 421 + git_head, 422 + if(conflict, label("conflict", "conflict")), 423 + ) ++ " ", 424 + separate(" ", 425 + if(self.contained_in("@.."), 426 + label("rest", separate(" ", 427 + if(empty, "(empty)"), 428 + if(description, 429 + description.first_line(), 430 + "(no description set)", 431 + ), 432 + )), 433 + separate(" ", 434 + if(empty, label("empty", "(empty)")), 435 + if(description, 436 + description.first_line(), 437 + label(if(empty, "empty"), description_placeholder), 438 + ), 439 + ) 440 + ), 441 + if(!(current_working_copy || parents), "\033[22m") 442 + ) ++ "\n", 443 + ), 444 + ) 442 445 ) 443 - ) 444 - ''; 446 + ''; 447 + }; 445 448 templates = { 446 449 git_push_bookmark = "'private/${config.home.username}/push-' ++ change_id.short()"; 447 450 commit_trailers = ''