add option to block message validation on merge-and-push
This commit is contained in:
parent
978088096c
commit
69007372fc
|
@ -350,8 +350,9 @@ def get_commits(repo, ref):
|
|||
|
||||
@redmine.command(name='merge-and-push')
|
||||
@click.option('--issue', default=None, type=int)
|
||||
@click.option('--validate-msg/--no-validate-msg', default=True)
|
||||
@click.argument('target_branch', default='master')
|
||||
def merge_and_push(issue, target_branch):
|
||||
def merge_and_push(issue, validate_msg, target_branch):
|
||||
issue = get_issue(issue or None)
|
||||
repo = get_repo()
|
||||
origin = repo.remote()
|
||||
|
@ -373,19 +374,21 @@ def merge_and_push(issue, target_branch):
|
|||
raise click.UsageError('%r is not a local branch.' % target_branch)
|
||||
|
||||
notes = '<pre>%s</pre>' % repo.git.log('%s..' % target_branch)
|
||||
for commit in get_commits(repo, target_branch):
|
||||
if (u'#%s' % get_current_issue()) not in commit.message:
|
||||
click.echo(click.style('Missing commit number in commit message', fg='red'))
|
||||
click.echo()
|
||||
click.echo(commit.message)
|
||||
raise click.Abort()
|
||||
if 'rebase' in commit.message:
|
||||
click.echo()
|
||||
click.echo('Commit %s contains the word "rebase" :' % commit.hexsha[:8])
|
||||
click.echo()
|
||||
click.echo(''.join([' ' + line for line in commit.message.splitlines()]))
|
||||
click.echo()
|
||||
click.confirm('Continue ?', abort=True)
|
||||
|
||||
if validate_msg:
|
||||
for commit in get_commits(repo, target_branch):
|
||||
if (u'#%s' % get_current_issue()) not in commit.message:
|
||||
click.echo(click.style('Missing commit number in commit message', fg='red'))
|
||||
click.echo()
|
||||
click.echo(commit.message)
|
||||
raise click.Abort()
|
||||
if 'rebase' in commit.message:
|
||||
click.echo()
|
||||
click.echo('Commit %s contains the word "rebase" :' % commit.hexsha[:8])
|
||||
click.echo()
|
||||
click.echo(''.join([' ' + line for line in commit.message.splitlines()]))
|
||||
click.echo()
|
||||
click.confirm('Continue ?', abort=True)
|
||||
|
||||
try:
|
||||
click.echo(u'Checking-out branch « %s » ... ' % target_branch, nl=False)
|
||||
|
|
Loading…
Reference in New Issue