set issue status to solved after merge-and-push
This commit is contained in:
parent
1f5f623893
commit
672244a433
|
@ -60,6 +60,7 @@ def get_redmine_api():
|
|||
redmine.engine.session.mount('https://', HTTPAdapter(max_retries=3))
|
||||
redmine.rustine = [cf for cf in redmine.custom_field.all() if cf.name == u'Rustine proposée'][0]
|
||||
redmine.solution = [st for st in redmine.issue_status.all() if st.name == u'Solution proposée'][0]
|
||||
redmine.resolu_a_deployer = [st for st in redmine.issue_status.all() if st.name == u'Résolu (à déployer)'][0]
|
||||
return redmine
|
||||
|
||||
|
||||
|
@ -329,8 +330,10 @@ class MyProgressPrinter(git.RemoteProgress):
|
|||
|
||||
|
||||
@redmine.command(name='merge-and-push')
|
||||
@click.option('--issue', default=None, type=int)
|
||||
@click.argument('target_branch', default='master')
|
||||
def merge_and_push(target_branch):
|
||||
def merge_and_push(issue, target_branch):
|
||||
issue = get_issue(issue or None)
|
||||
repo = get_repo()
|
||||
origin = repo.remote()
|
||||
|
||||
|
@ -420,6 +423,20 @@ def merge_and_push(target_branch):
|
|||
click.echo(click.style(u'\nFailure going back to branch « %s ».' % current_head, fg='red'))
|
||||
repo.branches[current_head].checkout()
|
||||
raise
|
||||
if click.confirm('Set issue status to solved ?', default=True):
|
||||
api = get_redmine_api()
|
||||
current_user = api.user.get('current')
|
||||
kwargs = {}
|
||||
if not hasattr(issue, 'assigned_to'):
|
||||
issue.assigned_to_id = current_user.id
|
||||
issue.save()
|
||||
elif issue.assigned_to.id != current_user.id:
|
||||
if click.confirm('Issue is currently assigned to %s, do you want '
|
||||
'to assign the issue to yourself ?' % issue.assigned_to.name):
|
||||
issue.assigned_to_id = current_user.id
|
||||
issue.save()
|
||||
kwargs['status_id'] = api.resolu_a_deployer.id
|
||||
api.issue.update(issue.id, **kwargs)
|
||||
|
||||
|
||||
@redmine.command(name='rebase')
|
||||
|
|
Loading…
Reference in New Issue