TriBITSPub / TriBITS

TriBITS: Tribal Build, Integrate, and Test System,
http://tribits.org
Other
36 stars 47 forks source link

Add parents' commit hashes to repoVersionStringOut in tribits_generate_single_repo_version_string() #597

Closed achauphan closed 6 months ago

achauphan commented 6 months ago

Related issues

Description

The current repo version output in TriBITS does not include the current commit's parents (if there are any). The parent commits are desirable in cases such as a merge commit, where examining a merge commit's parents are useful for determining which parents had changes performed to them across other merge commits.

This issue is in relation to [add issue number here], which plans to utilize a merge commit's parent sha1.

The current TriBITS repo version output is:

ProjectName repos versions:
--------------------------------------------------------------------------------
*** Base Git Repo: ProjectName
910f407 [Mon Oct 9 14:11:01 2023 -0600] <xxx@xxx.org>
topic branch tip commit message
 --------------------------------------------------------------------------------

The desired output would be something like:

ProjectName repos versions:
--------------------------------------------------------------------------------
*** Base Git Repo: ProjectName
2b9117b [Thu Dec 21 20:12:25 2023 -0700] <xxx@xxx.org>
Merge commit '910f40782a2e5dcbe0ce0fd3c176fbb8e276815a' into develop
    *** Parent: 1
    68b1db3da7a [Mon Oct 9 13:21:55 2023 -0400] <xxx@xxx.org>
    target branch tip commit message
    *** Parent: 2
    910f40782a2 [Mon Oct 9 14:11:01 2023 -0600] <xxx@xxx.org>
    topic branch tip commit message
...
 --------------------------------------------------------------------------------

Proposed Solution

Modify repoVersionStringOut in tribits_generate_single_repo_version_string() to include the parent commits.

The parents of a commit can be found with the following git commands with the same date and author formatting: git log -1 "--pretty=format:%h [%ad] <%ae>" HEAD^1 git log -1 "--pretty=format:%h [%ad] <%ae>" HEAD^2

Requirements

bartlettroscoe commented 6 months ago

@achauphan, we need to see if we can get the autotester to always generate a merge commit with git merge --no-ff <topic> even when a merge commit is not needed (because the tip of <topic> is downstream from the tip of <target>, i.e. develop). Otherwise, we need to add more complex logic to TriBITS and/or the Python script that pulls down data from CDash.

bartlettroscoe commented 6 months ago

With the merge of PR:

this story should be complete. This is in the process of being snapshotted to Trilinos in:

@achauphan, can we close this issue?