From 6db02ed5afacdc8f1ec1756702d1582b7bf24e9c Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Wed, 27 Jul 2022 13:17:12 -0400 Subject: 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 --- b4/ez.py | 12 ++++++++---- 1 file 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, -- cgit v1.2.3