From f665aa84c4d5a8e98609a5c875ef8cd1a4da80ec Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Mon, 28 Aug 2023 14:44:26 +0200 Subject: [PATCH 1/2] feat: use the `meta` repository to compute the branch Based on https://github.com/zopefoundation/meta/pull/202 The main benefit here is that when pushing updates on multiple repositories the branches are all the same, making it easier to see that they are based on the same changes. --- config/shared/git.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/config/shared/git.py b/config/shared/git.py index 475b51e..46b3a50 100644 --- a/config/shared/git.py +++ b/config/shared/git.py @@ -1,4 +1,6 @@ from .call import call +from .path import change_dir +import pathlib def get_commit_id(): @@ -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: From c303b1b131379a133baef3b15bef9fe65d531b19 Mon Sep 17 00:00:00 2001 From: Gil Forcada Codinachs Date: Sat, 16 Sep 2023 12:37:14 +0200 Subject: [PATCH 2/2] Add news entry --- news/1.feature | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 news/1.feature diff --git a/news/1.feature b/news/1.feature new file mode 100644 index 0000000..1692ff7 --- /dev/null +++ b/news/1.feature @@ -0,0 +1,2 @@ +When creating a branch, use the git commit hash from meta repository. +[gforcada]