on merge-and-push propose aborting if commit message contains rebase
This commit is contained in:
parent
554460811e
commit
74a2342278
|
@ -329,6 +329,11 @@ class MyProgressPrinter(git.RemoteProgress):
|
||||||
print(op_code, cur_count, max_count, cur_count / (max_count or 100.0), message or "NO MESSAGE")
|
print(op_code, cur_count, max_count, cur_count / (max_count or 100.0), message or "NO MESSAGE")
|
||||||
|
|
||||||
|
|
||||||
|
def get_commits(repo, ref):
|
||||||
|
for commit in git.Commit.iter_items(repo, '%s..' % ref):
|
||||||
|
yield commit
|
||||||
|
|
||||||
|
|
||||||
@redmine.command(name='merge-and-push')
|
@redmine.command(name='merge-and-push')
|
||||||
@click.option('--issue', default=None, type=int)
|
@click.option('--issue', default=None, type=int)
|
||||||
@click.argument('target_branch', default='master')
|
@click.argument('target_branch', default='master')
|
||||||
|
@ -353,6 +358,14 @@ def merge_and_push(issue, target_branch):
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise click.UsageError('%r is not a local branch.' % target_branch)
|
raise click.UsageError('%r is not a local branch.' % target_branch)
|
||||||
|
|
||||||
|
for commit in get_commits(repo, target_branch):
|
||||||
|
if 'rebase' in commit.message:
|
||||||
|
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:
|
try:
|
||||||
click.echo(u'Checking-out branch « %s » ... ' % target_branch, nl=False)
|
click.echo(u'Checking-out branch « %s » ... ' % target_branch, nl=False)
|
||||||
repo.branches[target_branch].checkout()
|
repo.branches[target_branch].checkout()
|
||||||
|
|
Loading…
Reference in New Issue