diff mbox series

[b4,RFC,2/3] ez: prep -n: always use fork-point as a base

Message ID 20230206-b4-prep-fork-point-as-base-branch-v1-2-2732e0c32f5d@tessares.net (mailing list archive)
State New
Headers show
Series "b4 prep --new --fork-point" is not clear to me | expand

Commit Message

Matthieu Baerts Feb. 6, 2023, 6:23 p.m. UTC
It is unclear to me why the current branch is used when 'fork point'
argument is given in the other strategies.

The explanation of the --fork-point option seems to suggest that this
fork point is will be the new base branch instead of HEAD. Then there is
no reason to look at the current branch which can be something totally
different.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 b4/ez.py | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)
diff mbox series

Patch

diff --git a/b4/ez.py b/b4/ez.py
index 2722c6c..9200d03 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -328,29 +328,7 @@  def start_new_series(cmdargs: argparse.Namespace) -> None:
             cmdargs.fork_point = 'HEAD'
             basebranch = mybranch
         else:
-            # if our strategy is not "commit", then we need to know which branch we're using as base
-            if strategy != 'commit':
-                gitargs = ['branch', '-v', '--contains', cmdargs.fork_point]
-                lines = b4.git_get_command_lines(None, gitargs)
-                if not lines:
-                    logger.critical('CRITICAL: no branch contains fork-point %s', cmdargs.fork_point)
-                    sys.exit(1)
-                for line in lines:
-                    chunks = line.split(maxsplit=2)
-                    # There's got to be a better way than checking for '*'
-                    if chunks[0] != '*':
-                        continue
-                    if chunks[1] == mybranch:
-                        logger.debug('branch %s does contain fork-point %s', mybranch, cmdargs.fork_point)
-                        basebranch = mybranch
-                        break
-            else:
-                basebranch = cmdargs.fork_point
-
-            if basebranch is None:
-                logger.critical('CRITICAL: fork-point %s is not on the current branch.', cmdargs.fork_point)
-                logger.critical('          Switch to the branch you want to use as base and try again.')
-                sys.exit(1)
+            basebranch = cmdargs.fork_point
 
         slug = re.sub(r'\W+', '-', cmdargs.new_series_name).strip('-').lower()
         branchname = 'b4/%s' % slug