Skip to content

Commit

Permalink
Merge pull request #255 from GEOS-ESM/develop
Browse files Browse the repository at this point in the history
GitFlow: Merge Develop into main for release
  • Loading branch information
mathomp4 committed Aug 17, 2023
2 parents 1b21435 + 22f4514 commit 912a251
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/mepo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 15 additions & 8 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand All @@ -27,7 +34,7 @@
"affiliation": "GMAO SSAI",
"orcid": "0000-0001-6222-6863",
"type": "ContactPerson"
},
},
{
"name": "Clune, Tom",
"affiliation": "NASA",
Expand All @@ -42,4 +49,4 @@
"yaml"
],
"access_right": "open"
}
}
24 changes: 16 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`
Expand All @@ -135,11 +143,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Allows `mepo checkout -b <branch>` to run on all repos rather than requiring one to be specified
- Allows `mepo checkout -b <branch>` 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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions mepo.d/cmdline/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
16 changes: 12 additions & 4 deletions mepo.d/command/status/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
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()
allcomps = MepoState.read_state()
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)
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions mepo.d/utest/test_mepo_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 912a251

Please sign in to comment.