Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a simple heuristic to determine if a git_tag is actually a git rev #41

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dependency_manager/src/edm_tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
"""Everest Dependency Manager."""
from edm_tool import edm
__version__ = "0.6.1"
__version__ = "0.6.2"


def get_parser():
Expand Down
9 changes: 8 additions & 1 deletion dependency_manager/src/edm_tool/edm.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import requests
import re
import datetime
import string


log = logging.getLogger("edm")
Expand Down Expand Up @@ -617,7 +618,7 @@ def create_config(cls, working_dir: Path, new_config: dict, external_in_config:
log.debug(f" tag: {tag}")
entry["git_tag"] = tag
except subprocess.CalledProcessError:
log.warning(f"Skipping {name} because no branch or tag could be determined.")
log.warning(f"No branch or tag could be determined for dependency {name}.")
continue
new_config[name] = entry

Expand Down Expand Up @@ -851,6 +852,12 @@ def clone_dependency_repo(git: str, git_tag: str, checkout_dir: Path) -> None:
log.debug(f" Repo is not dirty, checking out requested git tag \"{git_tag}\"")
GitInfo.checkout_rev(checkout_dir, git_tag)
else:
# check if git_tag is a 40 character hex string and assume it is a git_rev
if len(git_tag) == 40 and all(character in string.hexdigits for character in git_tag):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice expression 👍

log.debug(f" git_tag \"{git_tag}\" might be a git_rev, trying to checkout this rev.")
git_rev = git_tag
git_tag = None
git_tag_is_git_rev = True
try:
clone_dependency_repo(git, git_tag, checkout_dir)
except LocalDependencyCheckoutError as e:
Expand Down