report missing issue number in commit messages

This commit is contained in:
Benjamin Dauvergne 2019-03-27 21:18:50 +01:00
parent d500037d83
commit b3061993e0
1 changed files with 12 additions and 2 deletions

View File

@ -265,8 +265,14 @@ def submit(ctx, issue, number_of_commits):
message = message.split(MARKER, 1)[0].rstrip('\n')
api = get_redmine_api()
kwargs = {}
repo = get_repo()
for commit in get_commits(repo, 'master'):
if ('#%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 click.confirm('Push -f this branch to origin ?', default=True):
repo = get_repo()
origin = repo.remote()
for pi in origin.push(f=True):
if pi.flags & pi.ERROR:
@ -362,8 +368,12 @@ 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)
click.echo(notes)
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])