diff --git a/.github/workflows/mepo.yaml b/.github/workflows/mepo.yaml index 287f02f..4d9a466 100644 --- a/.github/workflows/mepo.yaml +++ b/.github/workflows/mepo.yaml @@ -24,8 +24,8 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt - timeout-minutes: 2 + timeout-minutes: 5 - name: Run unit tests run: python3 mepo.d/utest/test_mepo_commands.py -v - timeout-minutes: 2 + timeout-minutes: 5 diff --git a/.zenodo.json b/.zenodo.json index 0e6df44..4af213b 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,24 +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" + "name": "Chakraborty, Purnendu", + "affiliation": "SSAI", + "orcid": "0009-0002-7139-779X" }, { "name": "Jamieson, William", - "affiliation": "GMAO SSAI", + "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": [ @@ -27,7 +34,7 @@ "affiliation": "GMAO SSAI", "orcid": "0000-0001-6222-6863", "type": "ContactPerson" - }, + }, { "name": "Clune, Tom", "affiliation": "NASA", @@ -42,4 +49,4 @@ "yaml" ], "access_right": "open" -} +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 28e2fdf..febb815 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed +## [1.50.0] - 2023-08-17 + +### Added + +- Command `status` has now a `--hashes` option that list current HEAD hash for each component. + ## [1.49.0] - 2023-01-25 ### Changed @@ -107,9 +113,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 +143,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 +400,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 +440,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 diff --git a/mepo.d/utest/test_mepo_commands.py b/mepo.d/utest/test_mepo_commands.py index b3c386d..87d12af 100644 --- a/mepo.d/utest/test_mepo_commands.py +++ b/mepo.d/utest/test_mepo_commands.py @@ -74,6 +74,7 @@ def test_status(self): sys.stdout = output = StringIO() args.ignore_permissions=False args.nocolor=True + args.hashes=False mepo_status.run(args) sys.stdout = sys.__stdout__ with open(os.path.join(self.__class__.output_dir, 'status_output.txt'), 'r') as fin: