diff --git a/git_redmine.py b/git_redmine.py index 44d5c77..8f9f735 100644 --- a/git_redmine.py +++ b/git_redmine.py @@ -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") +def get_commits(repo, ref): + for commit in git.Commit.iter_items(repo, '%s..' % ref): + yield commit + + @redmine.command(name='merge-and-push') @click.option('--issue', default=None, type=int) @click.argument('target_branch', default='master') @@ -353,6 +358,14 @@ def merge_and_push(issue, target_branch): except IndexError: 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: click.echo(u'Checking-out branch « %s » ... ' % target_branch, nl=False) repo.branches[target_branch].checkout()