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 commit from meta (to create the branch name) #174

Merged
merged 2 commits into from
Sep 20, 2023
Merged
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
15 changes: 11 additions & 4 deletions config/shared/git.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from .call import call
from .path import change_dir
import pathlib


def get_commit_id():
Expand All @@ -9,15 +11,20 @@ def get_commit_id():


def get_branch_name(override, config_type):
"""Get the default branch name but prefer override if not empty."""
"""Get the default branch name but prefer override if not empty.

The commit ID is based on the meta repository.
"""
if override == "current":
# Note: can be empty if not on a branch.
override = call(
'git', 'branch', '--show-current',
capture_output=True).stdout.splitlines()[0]
return (
override
or f"config-with-{config_type}-template-{get_commit_id()}")

with change_dir(pathlib.Path(__file__).parent):
return (
override
or f"config-with-{config_type}-template-{get_commit_id()}")


def git_branch(branch_name) -> bool:
Expand Down
2 changes: 2 additions & 0 deletions news/1.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
When creating a branch, use the git commit hash from meta repository.
[gforcada]