push branch to origin on issue submit

This commit is contained in:
Benjamin Dauvergne 2019-03-11 15:30:05 +01:00
parent 169ba98417
commit 1f5f623893
1 changed files with 9 additions and 1 deletions

View File

@ -12,7 +12,6 @@ import git
import unidecode
import tempfile
import glob
import StringIO
import subprocess
from requests.adapters import HTTPAdapter
@ -31,6 +30,7 @@ def slugify(title):
def get_repo():
return git.Repo(search_parent_directories=True)
def get_config(name, default=Ellipsis):
repo = get_repo()
reader = repo.config_reader()
@ -263,6 +263,14 @@ def submit(ctx, issue, number_of_commits):
message = message.split(MARKER, 1)[0].rstrip('\n')
api = get_redmine_api()
kwargs = {}
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:
click.echo(click.style(u'Push from « %s » to « %s » failed.' % (
pi.local_ref.name, pi.remote_ref.name, pi.summary), fg='red'))
if click.confirm('Propose this patch as a solution ?'):
current_user = api.user.get('current')
if not hasattr(issue, 'assigned_to'):