Skip to content

Commit

Permalink
fix: get_git_repo_info result dictionary missing entries on error
Browse files Browse the repository at this point in the history
fix: bump version

Errors obtaining git information were triggering a KeyError exception
and hence failing to generate release.json

Traceback (most recent call last):
  File "/home/james/venv/bin/edm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/james/venv/lib/python3.12/site-packages/edm_tool/__init__.py", line 17, in main
    edm.main(get_parser())
  File "/home/james/venv/lib/python3.12/site-packages/edm_tool/edm.py", line 1667, in main
    args.action_handler(args)
  File "/home/james/venv/lib/python3.12/site-packages/edm_tool/edm.py", line 1301, in release_handler
    if everest_core_repo_info["rev"]:
       ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: 'rev'

Signed-off-by: James Chapman <[email protected]>
  • Loading branch information
james-ctc committed Nov 22, 2024
1 parent 2327220 commit 9cb76b9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
3 changes: 2 additions & 1 deletion dependency_manager/src/edm_tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#
"""Everest Dependency Manager."""
from edm_tool import edm
__version__ = "0.6.2"

__version__ = "0.7.0"


def get_parser():
Expand Down
22 changes: 17 additions & 5 deletions dependency_manager/src/edm_tool/edm.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,22 @@ def get_git_repo_info(cls, repo_path: Path, fetch=False) -> dict:
"""
Return useful information about a repository a the given path.
TODO: return type should be a well defined object
Returns an empty dictionary if the path is no git repo
Returns a default dictionary if the path is no git repo
"""
repo_info = {'is_repo': False}
repo_info = {
'is_repo': False,
'fetch_worked': None,
'remote_branch': None,
'behind': None,
'ahead': None,
'tag': None,
'branch': None,
'dirty': None,
'detached': None,
'rev': None,
'short_rev': None,
'url': None,
}
if GitInfo.is_repo(repo_path):
repo_info["is_repo"] = True
if fetch:
Expand Down Expand Up @@ -1628,9 +1640,9 @@ def get_parser(version) -> argparse.ArgumentParser:
type=str,
action="append",
help="Bazel-style label for the build files into the deppendencies. " +
"The format should be `@<workspace>//<path>:BUILD.<dependency-name>.bazel`." +
"The format should be `@<workspace>//<path>:BUILD.<dependency-name>.bazel`." +
"<dependency-name> should correspond to the name of the dependency in " +
"the dependencies.yaml file. This option can be used multiple times." +
"the dependencies.yaml file. This option can be used multiple times." +
"If not provided, Bazel will search for BUILD file in the repo itself.",
required=False)

Expand Down

0 comments on commit 9cb76b9

Please sign in to comment.