From 2018fe48dc047d7654fd2e815b1281a30bd7b0a1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 21 Nov 2024 12:17:22 -0700 Subject: [PATCH] Squashed '.lib/git-fleximod/' changes from 02e859950..50bd54c63 50bd54c63 Bump to 0.9.3 1e0c40a46 Merge pull request #66 from ESMCI/poetry_and_test_update 135770709 strip strip e7f9a261c fix issue 65 b1568e724 update poetry certifi version and update tests failing due to mpi-serial update git-subtree-dir: .lib/git-fleximod git-subtree-split: 50bd54c63e38c52e0bfc4a1d6bc6cb0eea6cf645 --- git_fleximod/cli.py | 38 ++++++++++++++++++++---------------- git_fleximod/git_fleximod.py | 2 +- git_fleximod/submodule.py | 2 +- poetry.lock | 6 +++--- pyproject.toml | 2 +- tbump.toml | 2 +- tests/conftest.py | 4 ++-- 7 files changed, 30 insertions(+), 26 deletions(-) diff --git a/git_fleximod/cli.py b/git_fleximod/cli.py index 208bc04684..ac9493cfc3 100644 --- a/git_fleximod/cli.py +++ b/git_fleximod/cli.py @@ -2,27 +2,31 @@ import argparse from git_fleximod import utils -__version__ = "0.9.2" +__version__ = "0.9.3" def find_root_dir(filename=".gitmodules"): """ finds the highest directory in tree which contains a file called filename """ - d = Path.cwd() - root = Path(d.root) - dirlist = [] - dl = d - while dl != root: - dirlist.append(dl) - dl = dl.parent - dirlist.append(root) - dirlist.reverse() - - for dl in dirlist: - attempt = dl / filename - if attempt.is_file(): - return str(dl) - return None - + try: + root = utils.execute_subprocess(["git","rev-parse", "--show-toplevel"], + output_to_caller=True ).rstrip() + except: + d = Path.cwd() + root = Path(d.root) + dirlist = [] + dl = d + while dl != root: + dirlist.append(dl) + dl = dl.parent + dirlist.append(root) + dirlist.reverse() + + for dl in dirlist: + attempt = dl / filename + if attempt.is_file(): + return str(dl) + return None + return Path(root) def get_parser(): description = """ diff --git a/git_fleximod/git_fleximod.py b/git_fleximod/git_fleximod.py index 0851e9d095..13f35df959 100755 --- a/git_fleximod/git_fleximod.py +++ b/git_fleximod/git_fleximod.py @@ -342,7 +342,7 @@ def main(): excludelist=excludelist, ) if not gitmodules.sections(): - sys.exit("No submodule components found") + sys.exit(f"No submodule components found, root_dir={root_dir}") retval = 0 if action == "update": submodules_update(gitmodules, root_dir, fxrequired, force) diff --git a/git_fleximod/submodule.py b/git_fleximod/submodule.py index c939d54bc9..75d9dd4eb9 100644 --- a/git_fleximod/submodule.py +++ b/git_fleximod/submodule.py @@ -221,7 +221,7 @@ def sparse_checkout(self): if superroot: gitroot = superroot.strip() else: - gitroot = self.root_dir.strip() + gitroot = self.root_dir # Now need to move the .git dir to the submodule location rootdotgit = os.path.join(self.root_dir, ".git") while os.path.isfile(rootdotgit): diff --git a/poetry.lock b/poetry.lock index 3a74effcd1..ac82fb0d97 100644 --- a/poetry.lock +++ b/poetry.lock @@ -30,13 +30,13 @@ dev = ["freezegun (>=1.0,<2.0)", "pytest (>=6.0)", "pytest-cov"] [[package]] name = "certifi" -version = "2024.6.2" +version = "2024.8.30" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2024.6.2-py3-none-any.whl", hash = "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56"}, - {file = "certifi-2024.6.2.tar.gz", hash = "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516"}, + {file = "certifi-2024.8.30-py3-none-any.whl", hash = "sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8"}, + {file = "certifi-2024.8.30.tar.gz", hash = "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 619cdabe3b..1d0419ad20 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "git-fleximod" -version = "0.9.2" +version = "0.9.3" description = "Extended support for git-submodule and git-sparse-checkout" authors = ["Jim Edwards "] maintainers = ["Jim Edwards "] diff --git a/tbump.toml b/tbump.toml index 920ff0591c..b432206a54 100644 --- a/tbump.toml +++ b/tbump.toml @@ -2,7 +2,7 @@ github_url = "https://github.com/jedwards4b/git-fleximod/" [version] -current = "0.9.2" +current = "0.9.3" # Example of a semver regexp. # Make sure this matches current_version before diff --git a/tests/conftest.py b/tests/conftest.py index 81edbe713e..1dd1b86f34 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -32,7 +32,7 @@ def logger(): "submodule_name": "test_optional", "status1" : "test_optional MPIserial_2.5.0-3-gd82ce7c is out of sync with .gitmodules MPIserial_2.4.0", "status2" : "test_optional at tag MPIserial_2.4.0", - "status3" : "test_optional not checked out, out of sync at tag None, expected tag is MPIserial_2.4.0 (optional)", + "status3" : "test_optional not checked out, out of sync at tag MPIserial_2.5.1, expected tag is MPIserial_2.4.0 (optional)", "status4" : "test_optional at tag MPIserial_2.4.0", "gitmodules_content": """ [submodule "test_optional"] @@ -46,7 +46,7 @@ def logger(): "submodule_name": "test_alwaysoptional", "status1" : "test_alwaysoptional MPIserial_2.3.0 is out of sync with .gitmodules e5cf35c", "status2" : "test_alwaysoptional at hash e5cf35c", - "status3" : "out of sync at tag None, expected tag is e5cf35c", + "status3" : "out of sync at tag MPIserial_2.5.1, expected tag is e5cf35c", "status4" : "test_alwaysoptional at hash e5cf35c", "gitmodules_content": """ [submodule "test_alwaysoptional"]