Skip to content

Commit

Permalink
Merge pull request #3008 from ActiveState/mitchell/dx-2398
Browse files Browse the repository at this point in the history
Added revision information to commit history.
  • Loading branch information
mitchell-as authored Jan 10, 2024
2 parents aea3508 + 29b12b9 commit ad9ccbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/runbits/commit/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/integration/history_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down

0 comments on commit ad9ccbd

Please sign in to comment.