From 29b12b9c016eea189460c73b71aa2795432616fe Mon Sep 17 00:00:00 2001 From: mitchell Date: Wed, 10 Jan 2024 11:54:27 -0500 Subject: [PATCH] Added revision information to commit history. This is analogous to the Dashboard's "Catalog Revision ID". --- internal/runbits/commit/commit.go | 7 +++++++ test/integration/history_int_test.go | 1 + 2 files changed, 8 insertions(+) diff --git a/internal/runbits/commit/commit.go b/internal/runbits/commit/commit.go index 1ac116d295..9bcc153c0b 100644 --- a/internal/runbits/commit/commit.go +++ b/internal/runbits/commit/commit.go @@ -20,6 +20,7 @@ type commitOutput struct { Hash string `locale:"hash,[HEADING]Commit[/RESET]" json:"hash"` Author string `locale:"author,[HEADING]Author[/RESET]" json:"author"` Date string `locale:"date,[HEADING]Date[/RESET]" json:"date"` + Revision string `locale:"revision,[HEADING]Revision[/RESET]" json:"revision"` Message string `locale:"message,[HEADING]Message[/RESET]" json:"message"` PlainChanges []string `locale:"changes,[HEADING]Changes[/RESET]" json:"-"` StructuredChanges []*requirementChange `opts:"hidePlain" json:"changes"` @@ -80,6 +81,12 @@ func newCommitOutput(commit *mono_models.Commit, orgs []gmodel.Organization, isL } commitOutput.Date = dt.Format(time.RFC822) + dt, err = time.Parse(time.RFC3339, commit.AtTime.String()) + if err != nil { + multilog.Error("Could not parse revision time: %v", err) + } + commitOutput.Revision = dt.Format(time.RFC822) + commitOutput.Message = locale.Tl("print_commit_no_message", "[DISABLED]Not provided.[/RESET]") if commit.Message != "" { commitOutput.Message = commit.Message diff --git a/test/integration/history_int_test.go b/test/integration/history_int_test.go index a6f9d15bc9..c59151b8a6 100644 --- a/test/integration/history_int_test.go +++ b/test/integration/history_int_test.go @@ -35,6 +35,7 @@ func (suite *HistoryIntegrationTestSuite) TestHistory_History() { cp.Expect("Commit") cp.Expect("Author") cp.Expect("Date") + cp.Expect("Revision") cp.Expect("Message") cp.Expect("• requests (2.26.0 → 2.7.0)") cp.Expect("• autopip (1.6.0 → Auto)")