Skip to content

Commit cdbc0cd

Browse files
committed
commons git-commit -m
1 parent 1dd9ec1 commit cdbc0cd

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

commons.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,9 @@ def git_diff(common):
527527
@click.option('-n', '--dry-run/--no-dry-run', is_flag=True, default=False, help='Dry run')
528528
@click.option('-i', '--interactive/--no-interactive', is_flag=True, default=True,
529529
help='prompts before copying into each project')
530+
@click.option('-m', '--message', metavar='message', default=None)
530531
@click.argument('common', metavar='common', envvar="COMMON", nargs=1, type=str, required=False)
531-
def git_commit(common, dry_run, interactive):
532+
def git_commit(common, dry_run, interactive, message):
532533
"""
533534
performs a git commit in all projects that have that common file - requires exactly one argument
534535
the message is labelled as 'adopt latest version of <common_file>'
@@ -554,7 +555,10 @@ def git_commit(common, dry_run, interactive):
554555
if not file.has_pending_changes('index'):
555556
print(f"skipping project {project} - no pending changes in {common}")
556557
continue
557-
commit_message = f"'adopt latest version of {common.common}'"
558+
if message is not None:
559+
commit_message = f"'{message}'"
560+
else:
561+
commit_message = f"'adopt latest version of {common.common}'"
558562
command = f"git -C {COMMON_ROOT / project} commit -m{commit_message}"
559563
print(f"{4*'-'} {project}")
560564
run_commands([command], dry_run=dry_run, interactive=interactive)

0 commit comments

Comments
 (0)