aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--b4/command.py4
-rw-r--r--b4/ez.py27
2 files changed, 30 insertions, 1 deletions
diff --git a/b4/command.py b/b4/command.py
index 2db9f7a..fb9f6d4 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -255,6 +255,10 @@ def cmd():
sp_ezs = subparsers.add_parser('ez-series', help='Simplify work on series submitted for review')
sp_ezs.add_argument('--edit-cover', action='store_true', default=False,
help='Edit the cover letter in your defined $EDITOR (or core.editor)')
+ sp_ezs.add_argument('--show-revision', action='store_true', default=False,
+ help='Show current series revision number')
+ sp_ezs.add_argument('--force-revision', default=False, type=int,
+ help='Force revision to be this number instead')
ag_ezn = sp_ezs.add_argument_group('Create new branch', 'Create new branch for ez-series')
ag_ezn.add_argument('-n', '--new', dest='new_series_name',
help='Create a new branch and prepare for new series')
diff --git a/b4/ez.py b/b4/ez.py
index 6fcf80c..36205da 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -933,13 +933,32 @@ def cmd_ez_send(cmdargs: argparse.Namespace) -> None:
store_cover(new_cover, tracking)
-def check_can_gfr():
+def check_can_gfr() -> None:
if not can_gfr:
logger.critical('ERROR: b4 submit requires git-filter-repo. You should be able')
logger.critical(' to install it from your distro packages, or from pip.')
sys.exit(1)
+def show_revision() -> None:
+ cover, tracking = load_cover()
+ ts = tracking['series']
+ logger.info('v%s', ts.get('revision'))
+ if 'history' in ts:
+ config = b4.get_main_config()
+ logger.info('---')
+ for rn, links in ts['history'].items():
+ for link in links:
+ logger.info(' %s: %s', rn, config['linkmask'] % link)
+
+
+def force_revision(forceto: int) -> None:
+ cover, tracking = load_cover()
+ tracking['series']['revision'] = forceto
+ logger.info('Forced revision to v%s', forceto)
+ store_cover(cover, tracking)
+
+
def cmd_ez_series(cmdargs: argparse.Namespace) -> None:
check_can_gfr()
status = b4.git_get_repo_status()
@@ -951,6 +970,12 @@ def cmd_ez_series(cmdargs: argparse.Namespace) -> None:
if cmdargs.edit_cover:
return edit_cover()
+ if cmdargs.show_revision:
+ return show_revision()
+
+ if cmdargs.force_revision:
+ return force_revision(cmdargs.force_revision)
+
if is_ez_branch():
logger.critical('CRITICAL: This appears to already be an ez-series branch.')
sys.exit(1)