diff --git a/CHANGELOG.md b/CHANGELOG.md index 04d6467..7be15c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +## [2.3.2] - 2025-04-24 + +### Fixed + +- Fixed `checkout` command to use `--recurse-submodules` if component has submodules + ## [2.3.1] - 2025-04-16 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index 5c58072..fb7c7ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mepo" -version = "2.3.1" +version = "2.3.2" description = "A tool for managing (m)ultiple r(epo)s" authors = [{name="GMAO SI Team", email="siteam@gmao.gsfc.nasa.gov"}] dependencies = [ diff --git a/src/mepo/command/checkout-if-exists.py b/src/mepo/command/checkout-if-exists.py index bb59628..6a20db7 100644 --- a/src/mepo/command/checkout-if-exists.py +++ b/src/mepo/command/checkout-if-exists.py @@ -30,4 +30,6 @@ def run(args): colors.RESET + comp.name + colors.RESET, ) ) - git.checkout(ref_name, args.detach) + git.checkout( + ref_name, detach=args.detach, recurse=comp.recurse_submodules + ) diff --git a/src/mepo/command/checkout.py b/src/mepo/command/checkout.py index ae76773..b954753 100644 --- a/src/mepo/command/checkout.py +++ b/src/mepo/command/checkout.py @@ -30,7 +30,7 @@ def run(args): colors.RESET + comp.name + colors.RESET, ) ) - git.checkout(branch, args.detach) + git.checkout(branch, detach=args.detach, recurse=comp.recurse_submodules) def _get_comps_to_checkout(specified_comps, allcomps): diff --git a/src/mepo/command/clone.py b/src/mepo/command/clone.py index 599692e..fecab8d 100644 --- a/src/mepo/command/clone.py +++ b/src/mepo/command/clone.py @@ -68,7 +68,7 @@ def clone_fixture(url, branch=None, directory=None, partial=None): last_url_node = p.path.rsplit("/")[-1] directory = pathlib.Path(last_url_node).stem git = GitRepository(url, directory) - git.clone(branch, partial) + git.clone(branch, partial=partial) return directory @@ -105,7 +105,7 @@ def clone_components(allcomps, partial): version = comp.version.name version = version.replace("origin/", "") git = GitRepository(comp.remote, comp.local) - git.clone(version, recurse_submodules, partial) + git.clone(version, recurse=recurse_submodules, partial=partial) if comp.sparse: git.sparsify(comp.sparse) print_clone_info(comp.name, comp.version, max_namelen) @@ -123,4 +123,4 @@ def checkout_all_repos(allcomps, branch): branch_y = colors.YELLOW + branch + colors.RESET print(f"Checking out {branch_y} in {comp.name}") git = GitRepository(comp.remote, comp.local) - git.checkout(branch) + git.checkout(branch, recurse=comp.recurse_submodules) diff --git a/src/mepo/command/develop.py b/src/mepo/command/develop.py index e679955..58d3828 100644 --- a/src/mepo/command/develop.py +++ b/src/mepo/command/develop.py @@ -20,5 +20,5 @@ def run(args): colors.RESET + comp.name + colors.RESET, ) ) - git.checkout(comp.develop) + git.checkout(comp.develop, recurse=comp.recurse_submodules) _ = git.pull() diff --git a/src/mepo/command/restore-state.py b/src/mepo/command/restore-state.py index 3d9fe86..e520648 100644 --- a/src/mepo/command/restore-state.py +++ b/src/mepo/command/restore-state.py @@ -41,4 +41,4 @@ def restore_state(allcomps, result): colors.RED + current_version + colors.RESET, ) ) - git.checkout(comp.version.name) + git.checkout(comp.version.name, recurse=comp.recurse_submodules) diff --git a/src/mepo/git.py b/src/mepo/git.py index deb223d..7a035e0 100644 --- a/src/mepo/git.py +++ b/src/mepo/git.py @@ -60,10 +60,12 @@ def clone(self, version=None, recurse=None, partial=None): shellcmd.run(shlex.split(cmd)) if version is not None: - self.checkout(version) + self.checkout(version, recurse=recurse) - def checkout(self, version, detach=False): + def checkout(self, version, detach=False, recurse=None): cmd = self.__git + " checkout " + if recurse is not None: + cmd += " --recurse-submodules " cmd += "--quiet {}".format(version) shellcmd.run(shlex.split(cmd)) if detach: diff --git a/tests/test_mepo_commands.py b/tests/test_mepo_commands.py index 51716d3..f9b9379 100644 --- a/tests/test_mepo_commands.py +++ b/tests/test_mepo_commands.py @@ -337,7 +337,7 @@ def test_reset(self): self.__class__.__mepo_clone() def test_mepo_version(self): - self.assertEqual(get_mepo_version(), "2.3.1") + self.assertEqual(get_mepo_version(), "2.3.2") def tearDown(self): pass