From b71d54523a43055175cd55c9eb04f9b4bd81427d Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Wed, 17 Sep 2025 23:40:19 +0000 Subject: [PATCH] feat(jujutsu): add timestamp.ago() to format Change-Id: xqpmvvkspxvmkntlwwuqsoknttulwquu 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 --- packetmix/homes/development/jujutsu.nix | 79 +++++++++++++------------ 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/packetmix/homes/development/jujutsu.nix b/packetmix/homes/development/jujutsu.nix index 7207d9ef..2d496fad 100644 --- a/packetmix/homes/development/jujutsu.nix +++ b/packetmix/homes/development/jujutsu.nix @@ -403,45 +403,48 @@ signingScriptScriptFSPath; }; snapshot.auto-track = "~(root-glob:'**/.envrc' | root-glob:'**/*.env' | root-glob:'**/.direnv/**/*')"; - template-aliases.series_log = '' - if(root, - format_root_commit(self), - label(if(current_working_copy, "working_copy"), - concat( - if(current_working_copy, label("op_log current_operation id", "@"), - if(self.contained_in("..@"), label("diff added", "-"), - label("diff removed", "+") - )), - " ", - separate(" ", - format_short_change_id_with_hidden_and_divergent_info(self), - format_short_commit_id(commit_id), - git_head, - if(conflict, label("conflict", "conflict")), - ) ++ " ", - separate(" ", - if(self.contained_in("@.."), - label("rest", separate(" ", - if(empty, "(empty)"), - if(description, - description.first_line(), - "(no description set)", - ), - )), - separate(" ", - if(empty, label("empty", "(empty)")), - if(description, - description.first_line(), - label(if(empty, "empty"), description_placeholder), - ), - ) - ), - if(!(current_working_copy || parents), "\033[22m") - ) ++ "\n", - ), + template-aliases = { + "format_timestamp(timestamp)" = ''timestamp.local().format("%Y-%m-%d %H:%M:%S") ++ " (" ++ timestamp.ago() ++ ")"''; + series_log = '' + if(root, + format_root_commit(self), + label(if(current_working_copy, "working_copy"), + concat( + if(current_working_copy, label("op_log current_operation id", "@"), + if(self.contained_in("..@"), label("diff added", "-"), + label("diff removed", "+") + )), + " ", + separate(" ", + format_short_change_id_with_hidden_and_divergent_info(self), + format_short_commit_id(commit_id), + git_head, + if(conflict, label("conflict", "conflict")), + ) ++ " ", + separate(" ", + if(self.contained_in("@.."), + label("rest", separate(" ", + if(empty, "(empty)"), + if(description, + description.first_line(), + "(no description set)", + ), + )), + separate(" ", + if(empty, label("empty", "(empty)")), + if(description, + description.first_line(), + label(if(empty, "empty"), description_placeholder), + ), + ) + ), + if(!(current_working_copy || parents), "\033[22m") + ) ++ "\n", + ), + ) ) - ) - ''; + ''; + }; templates = { git_push_bookmark = "'private/${config.home.username}/push-' ++ change_id.short()"; commit_trailers = '' -- 2.43.0