Skip to content

Commit

Permalink
WiP: patching.py: BASE_GIT_TAG now very sneakily also accepts a branc…
Browse files Browse the repository at this point in the history
…h name
  • Loading branch information
rpardini committed May 8, 2023
1 parent 7b6339d commit 48a34b4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/tools/patching.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,16 @@
raise Exception("BASE_GIT_REVISION or BASE_GIT_TAG must be set")
else:
log.debug(f"Getting revision of BASE_GIT_TAG={BASE_GIT_TAG}")
BASE_GIT_REVISION = git_repo.tags[BASE_GIT_TAG].commit.hexsha
# first, try as a tag:
try:
BASE_GIT_REVISION = git_repo.tags[BASE_GIT_TAG].commit.hexsha
except IndexError:
# not a tag, try as a branch:
try:
BASE_GIT_REVISION = git_repo.branches[BASE_GIT_TAG].commit.hexsha
except IndexError:
raise Exception(f"BASE_GIT_TAG={BASE_GIT_TAG} is neither a tag nor a branch")

log.debug(f"Found BASE_GIT_REVISION={BASE_GIT_REVISION} for BASE_GIT_TAG={BASE_GIT_TAG}")

patching_utils.prepare_clean_git_tree_for_patching(git_repo, BASE_GIT_REVISION, BRANCH_FOR_PATCHES)
Expand Down

0 comments on commit 48a34b4

Please sign in to comment.