-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add parents' commit hashes to repoVersionStringOut in tribits_generate_single_repo_version_string() #597
Comments
Added test TribitsHelloWorld_config_git_version that uses mockprogram.py as git to generate and check git version info. ToDo: We should also check the generated TribitsHelloWorldRepoVersion.txt file
For some reason, mockprogram.py prints an newline that raw git does not. But this should work for raw git too.
@achauphan, we need to see if we can get the autotester to always generate a merge commit with |
Renamed the test TribitsHelloWorld_config_git_version to TribitsHelloWorld_config_git_version_single_repo_one_parent to correctly state the scope of the test and allow for future similar tests with slightly a difference scopes (such as single_repo_two_parents, multi_repo_one_parent, etc).
…euse (#597) Moved git commit info functionality of tribits_generate_single_repo_version_string to a seperate helper function named tribites_generate_commit_info_string. The core functionality and output is the same. This is in prep for reuse of that functionality inside of the original tribits_generate_single_repo_version string.
…#597) Removed trailing whitespace to keep git command outputs consistent with other functions performing git commands and for the output to be more processable.
Renamed the test TribitsHelloWorld_config_git_version to TribitsHelloWorld_config_git_version_single_repo_one_parent to correctly state the scope of the test and allow for future similar tests with slightly a difference scopes (such as single_repo_two_parents, multi_repo_one_parent, etc).
…euse (#597) Moved git commit info functionality of tribits_generate_single_repo_version_string to a separate helper function named tribites_generate_commit_info_string. The core functionality and output is the same. This is in prep for reuse of that functionality inside of the original tribits_generate_single_repo_version string.
…#597) Removed trailing whitespace to keep git command outputs consistent with other functions performing git commands and for the output to be more processable.
Make tribits_generate_commit_info_string output commit info based on a passed in commit sha1.
…est (#597) Updated mockprogram inputs and outputs to be more specific about which commit message is being outputted.
If the HEAD sha1 contains more than one parent, include each parent's commit info in the final repoVersionStringOut of tribits_generate_single_repo_version_string.
Forgot to double quote variable and caused configure failures during Github Actions testing.
Added global cmake cache variable `<PROJECT_NAME>_SHOW_GIT_COMMIT_PARENTS:BOOL` that is default to OFF. This will be a project based variable to including parent commit info in the repo version output.
Reordered git log arguments to the expected order as well as condensed cmake command arguments into a single line.
Instead of passing in the deferenced HEAD SHA1 to tribites_generate_commit_info_string, simply just pass in the HEAD pointer keyword for Git to deference itself.
…tput (#597) In the off chance that Git decides to change the output of git log -1 "--pretty=format:%p", use a regex match and replace in cmake to match consecutive spaces and replace them with a single ;.
Simplified foreach loop in tribits_generate_single_repo_version_string and changed the parent indexing to be 1-based instead of 0-based.
Implemented usage of previously added global cmake variable, `PROJECT_NAME_SHOW_GIT_COMMIT_PARENTS` in `tribits_generate_single_repo_version_string`. This is done with an optional argument named INCLUDE_COMMIT_PARENTS whenever calling `tribits_generate_single_repo_version_string`
Cleaned up empty lines in `TribitsHelloWorld_Tests.cmake`
…#597) Implemented usage of previously added global cmake variable, `PROJECT_NAME_SHOW_GIT_COMMIT_PARENTS` in `tribits_generate_single_repo_version_string`. This is done with an optional argument named INCLUDE_COMMIT_PARENTS whenever calling `tribits_generate_single_repo_version_string`
With Clean Code ordering (i.e. the Newspaper Metaphor), in general, the functions should be ordered from top-level to low-level in the calling order. That is, the functions that are called in a given function should be listed below that function.
Cleaned up empty lines in `TribitsHelloWorld_Tests.cmake`
This allows the calling code to be more compact. Since this function is not really called by any external users (perhaps ever), this seems like a good trade-off.
…HANDLING_ONLY=ON (TriBITSPub#597) This spead up these tests on my machine 'crf450' from about 3.4 sec to about 0.45 sec. We don't need to enable the compilers and process the package CMakeLists.txt files to test this version info.
This is a variable that project developers and users should know about.
…up (TriBITSPub#597) Using camelCase for local vars helps to differentiate from UPPER_CACHE vars for function argument keywords and global vars. I figured I would clean this function up while I was working on it. Now this fits in one screen-shot for me.
…utils/ (TriBITSPub#597) I noticed that this module does not depend on the TriBITS framework in any way so it should live under the core/utils/ directory to make that clear and to allow easy reuse in non-TriBITS projects that would like to use it.
…IT_COMMIT_PARENTS (TriBITSPub#597) We eventually need to use this for all of those vars to make that code more compact.
I noticed this while looking at the documentation while working on TriBITSPub#597.
TriBITSPub#597) This sets the option: -DTribitsExMetaProj_SHOW_GIT_COMMIT_PARENTS=ON in the inner CMake configuration with a multi-repo setup so we can test the extraction and printing of the parent commit info. This tests a call of the function tribits_generate_single_repo_version_string() for extra repos from the function tribits_generate_repo_version_file_string(). This test also validates that the correct Git commands are called since this uses real Git on a Git repos. The downside of this updated test is that it makes it a little more difficult to maintain these tests when we have to update these snapshotted Git repos.
TriBITSPub#597) This sets the option: -DTribitsExMetaProj_SHOW_GIT_COMMIT_PARENTS=ON in the inner CMake configuration with a multi-repo setup so we can test the extraction and printing of the parent commit info. This tests a call of the function tribits_generate_single_repo_version_string() for extra repos from the function tribits_generate_repo_version_file_string(). This test also validates that the correct Git commands are called since this uses real Git on a Git repos. The downside of this updated test is that it makes it a little more difficult to maintain these tests when we have to update these snapshotted Git repos.
Add git version info for parent commits (#597)
…arent-info (TriBITSPub/TriBITS#597) Main purpose is to pull in the TriBITS PR for getting the git repo parent commit info: * TriBITSPub/TriBITS#598
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? |
…riBITSPub/TriBITS#597) This is needed to know the versions of the target and topic branches for PR builds submitted to CDash. This is needed to be able to detect random test failures.
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:
The desired output would be something like:
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
The text was updated successfully, but these errors were encountered: