diff --git a/.zenodo.json b/.zenodo.json index 4ad806c..4af213b 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,29 +1,31 @@ { - "license": "other-open", - "upload_type": "software", + "license": "other-open", + "upload_type": "software", "creators": [ { "name": "Thompson, Matthew", "affiliation": "GMAO SSAI", "orcid": "0000-0001-6222-6863" - }, - + }, { "name": "Chakraborty, Purnendu", "affiliation": "SSAI", "orcid": "0009-0002-7139-779X" - }, - + }, { "name": "Jamieson, William", "affiliation": "Space Telescope Science Institute", "orcid": "0000-0001-5976-4492" - }, - + }, { "name": "Clune, Tom", "affiliation": "NASA", "orcid": "0000-0003-3320-0204" + }, + { + "name": "Deconinck, Florian", + "affiliation": "NASA SSAI", + "orcid": "0000-0002-0925-917X" } ], "contributors": [ @@ -32,7 +34,7 @@ "affiliation": "GMAO SSAI", "orcid": "0000-0001-6222-6863", "type": "ContactPerson" - }, + }, { "name": "Clune, Tom", "affiliation": "NASA", @@ -47,4 +49,4 @@ "yaml" ], "access_right": "open" -} +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 28e2fdf..d2181fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +Command `status` has now a `--hashes` option that list current HEAD hash for each component. + ### Changed ### Removed @@ -107,9 +109,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - When running `mepo compare` and `mepo status`, detatched branches will also display the commit id: + ``` GEOSgcm_GridComp | (b) feature/aogcm (DH, 0793f7b2) ``` + - GitHub Actions updates - Uses `pypy-3.8` specifically - Have `pip` install from `requirements.txt` @@ -135,11 +139,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -* Allows `mepo checkout -b ` to run on all repos rather than requiring one to be specified +- Allows `mepo checkout -b ` to run on all repos rather than requiring one to be specified ### Fixed -* Fixes a bug in handling paths with spaces in folder names +- Fixes a bug in handling paths with spaces in folder names ## [1.36.1] - 2021-08-19 @@ -392,11 +396,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -* Update the CI to use a matrix on Linux and macOS of python3.x and pypy3 +- Update the CI to use a matrix on Linux and macOS of python3.x and pypy3 ### Fixed -* Fix the unit tests +- Fix the unit tests ## [1.11.0] - 2020-05-28 @@ -432,10 +436,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -* Add `--name-only` to `mepo diff` -* Add colors to `mepo status` for non-original branches -* Make `checkout-if-exists` more verbose -* Make `mepo commit` act more like `git commit` +- Add `--name-only` to `mepo diff` +- Add colors to `mepo status` for non-original branches +- Make `checkout-if-exists` more verbose +- Make `mepo commit` act more like `git commit` ## [1.6.0] - 2020-02-19 diff --git a/mepo.d/cmdline/parser.py b/mepo.d/cmdline/parser.py index 0a810eb..5407b46 100644 --- a/mepo.d/cmdline/parser.py +++ b/mepo.d/cmdline/parser.py @@ -124,6 +124,10 @@ def __status(self): '--nocolor', action = 'store_true', help = 'Tells status to not display colors.') + status.add_argument( + '--hashes', + action = 'store_true', + help = 'Print the exact hash of the HEAD.') def __restore_state(self): restore_state = self.subparsers.add_parser( diff --git a/mepo.d/command/status/status.py b/mepo.d/command/status/status.py index abade08..ef7df68 100644 --- a/mepo.d/command/status/status.py +++ b/mepo.d/command/status/status.py @@ -6,7 +6,9 @@ from state.state import MepoState from repository.git import GitRepository from utilities.version import version_to_string, sanitize_version_string -from utilities import colors +from utilities import colors, shellcmd +from command.whereis.whereis import _get_relative_path +import shlex def run(args): print('Checking status...'); sys.stdout.flush() @@ -14,7 +16,7 @@ def run(args): pool = mp.Pool() atexit.register(pool.close) result = pool.starmap(check_component_status, [(comp, args.ignore_permissions) for comp in allcomps]) - print_status(allcomps, result, args.nocolor) + print_status(allcomps, result, args.nocolor, args.hashes) def check_component_status(comp, ignore): git = GitRepository(comp.remote, comp.local) @@ -32,12 +34,18 @@ def check_component_status(comp, ignore): return (curr_ver, internal_state_branch_name, git.check_status(ignore)) -def print_status(allcomps, result, nocolor=False): +def print_status(allcomps, result, nocolor=False, hashes=False): orig_width = len(max([comp.name for comp in allcomps], key=len)) for index, comp in enumerate(allcomps): time.sleep(0.025) current_version, internal_state_branch_name, output = result[index] - + if hashes: + comp_path = _get_relative_path(comp.local) + comp_hash = shellcmd.run( + cmd=shlex.split(f"git -C {comp_path} rev-parse HEAD"), + output=True + ).replace("\n", "") + current_version = f"{current_version} ({comp_hash})" # This should handle tag weirdness... if current_version.split()[1] == comp.version.name: component_name = comp.name