aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2022-07-27 13:17:12 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2022-07-27 13:17:12 -0400
commit6db02ed5afacdc8f1ec1756702d1582b7bf24e9c (patch)
tree3024d839c3982a779a9b9c311ca1436aed629c95
parent9d64075f5902052a83a722306239ac8d033b84b3 (diff)
downloadb4-6db02ed5afacdc8f1ec1756702d1582b7bf24e9c.tar.gz
ez: record cover strategy on branch creation/enrollment
Just in case someone desides to switch the global cover strategy to something else, record the current branch strategy as part of the branch config. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/ez.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/b4/ez.py b/b4/ez.py
index b3d050c..87e8334 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -178,12 +178,12 @@ def start_new_series(cmdargs: argparse.Namespace) -> None:
sys.exit(1)
cover = None
+ strategy = get_cover_strategy()
if cmdargs.new_series_name:
basebranch = None
if not cmdargs.fork_point:
cmdargs.fork_point = 'HEAD'
else:
- strategy = get_cover_strategy()
# if our strategy is not "commit", then we need to know which branch we're using as base
mybranch = b4.git_get_current_branch()
if strategy != 'commit':
@@ -219,12 +219,13 @@ def start_new_series(cmdargs: argparse.Namespace) -> None:
elif cmdargs.base_branch:
# Check that strategy isn't "commit" as we don't currently support that
- if get_cover_strategy() == 'commit':
+ if strategy == 'commit':
logger.critical('CRITICAL: enrolling branches with "commit" cover strategy is not currently supported')
sys.exit(1)
- seriesname = b4.git_get_current_branch()
- slug = re.sub(r'\W+', '-', seriesname).strip('-').lower()
+ branchname = b4.git_get_current_branch()
+ seriesname = branchname
+ slug = re.sub(r'\W+', '-', branchname).strip('-').lower()
basebranch = cmdargs.base_branch
try:
forkpoint, commitcount = get_base_forkpoint(basebranch)
@@ -238,6 +239,9 @@ def start_new_series(cmdargs: argparse.Namespace) -> None:
logger.critical('CRITICAL: unknown operation requested')
sys.exit(1)
+ # Store our cover letter strategy in the branch config
+ b4.git_set_config(None, f'branch.{branchname}.b4-prep-cover-strategy', strategy)
+
if not cover:
# create a default cover letter and store it where the strategy indicates
cover = ('EDITME: cover title for %s' % seriesname,