Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	pyproject.toml
#	tests/test_mepo_clone.py
#	tests/test_mepo_commands.py
  • Loading branch information
mathomp4 committed Jan 13, 2025
2 parents 26fc827 + a8ef77b commit 5fe9c3d
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 19 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

## [2.3.0] - 2025-01-12

### Changed

- Moved `mepo status` and `mepo restore-state` to default to their serial variants rather than parallel by default. At the same time, we remove the `--serial` option from these commands and add a `--parallel` option if users want to run them in parallel.

## [2.2.1] - 2025-01-03

### Fixed

- Fixed bugs in the lesser used options of `mepo clone`, `allrepos` and `registry`


### Added

- Added tests for `mepo clone --allrepos` and `mepo clone --registry`


## [2.2.0] - 2024-12-24


### Added

- Hidden option `--location` for mepo that returns the path to the mepo directory
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mepo"
version = "2.2.1"
version = "2.3.0"
description = "A tool for managing (m)ultiple r(epo)s"
authors = [{name="GMAO SI Team", email="[email protected]"}]
dependencies = [
Expand Down
4 changes: 2 additions & 2 deletions src/mepo/cmdline/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def __status(self):
"--hashes", action="store_true", help="Print the exact hash of the HEAD."
)
status.add_argument(
"--serial", action="store_true", help="Run the serial version."
"--parallel", action="store_true", help="Run the parallel version."
)

def __restore_state(self):
Expand All @@ -198,7 +198,7 @@ def __restore_state(self):
aliases=mepoconfig.get_command_alias("restore-state"),
)
restore_state.add_argument(
"--serial", action="store_true", help="Run the serial version."
"--parallel", action="store_true", help="Run the parallel version."
)

def __diff(self):
Expand Down
8 changes: 4 additions & 4 deletions src/mepo/command/restore-state.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
def run(args):
print("Checking status...", flush=True)
allcomps = MepoState.read_state()
if args.serial:
if args.parallel:
with mp.Pool() as pool:
result = pool.map(check_component_status, allcomps)
else:
result = []
for comp in allcomps:
result.append(check_component_status(comp))
else:
with mp.Pool() as pool:
result = pool.map(check_component_status, allcomps)
restore_state(allcomps, result)


Expand Down
10 changes: 5 additions & 5 deletions src/mepo/command/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ def run(args):
allcomps = MepoState.read_state()
# max_width = len(max([comp.name for comp in allcomps], key=len))
max_width = max([len(comp.name) for comp in allcomps])
if args.serial:
for comp in allcomps:
result = check_component_status(comp, args.ignore_permissions)
print_component_status(comp, result, max_width, args.nocolor, args.hashes)
else:
if args.parallel:
with mp.Pool() as pool:
result = pool.starmap(
check_component_status,
[(comp, args.ignore_permissions) for comp in allcomps],
)
print_status(allcomps, result, max_width, args.nocolor, args.hashes)
else:
for comp in allcomps:
result = check_component_status(comp, args.ignore_permissions)
print_component_status(comp, result, max_width, args.nocolor, args.hashes)


def check_component_status(comp, ignore_permissions):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mepo_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_mepo_status():
ignore_permissions=False,
nocolor=True,
hashes=False,
serial=True,
parallel=False,
)
with contextlib.redirect_stdout(io.StringIO()) as output:
mepo_status.run(args)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_mepo_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __mepo_status(self, saved_output):
ignore_permissions=False,
nocolor=True,
hashes=False,
serial=False,
parallel=True,
)
with contextlib.redirect_stdout(io.StringIO()) as output:
mepo_status.run(args)
Expand All @@ -112,7 +112,7 @@ def __mepo_status(self, saved_output):

def __mepo_restore_state(self):
os.chdir(self.__class__.fixture_dir)
args = SimpleNamespace(serial=False)
args = SimpleNamespace(parallel=True)
with contextlib.redirect_stdout(io.StringIO()) as _:
mepo_restore_state.run(args)
self.__mepo_status(self.__class__.output_clone_status)
Expand Down Expand Up @@ -337,7 +337,7 @@ def test_reset(self):
self.__class__.__mepo_clone()

def test_mepo_version(self):
self.assertEqual(get_mepo_version(), "2.2.1")
self.assertEqual(get_mepo_version(), "2.3.0")

def tearDown(self):
pass
Expand Down

0 comments on commit 5fe9c3d

Please sign in to comment.