def _fetch_patches(id, chunk): issue = Issue(id) try: issue.get_attachments(chunk) print _success_message.format(issue._get_issue_path()) except IssueError as err: print _failure_message.format(err.message) sys.exit(-1)
def _fetch_patches(id, chunk): issue = Issue(id) try: issue.get_attachments(chunk) print _success_message.format(issue._get_issue_path()) except IssueError as err: print _failure_message.format(err.message) sys.exit(-1)
def _create_issue(subject, attachments): issue = Issue(None, subject, attachments) try: metadata = issue.create() print _success_message.format( metadata['issue']['id'], metadata['issue']['subject'], metadata['issue']['tracker']['name'], metadata['issue']['project']['name']) except IssueError as err: print _failure_message.format('creating issue', err.message) sys.exit(-1)
def create(ctx, redmine, *args, **kwargs): """ Create new issue """ if ctx.parent.alias: kwargs.update(ctx.parent.params) if kwargs.get("edit"): kwargs["description"] = get_description() if kwargs.get("start") in ["now", "today"]: kwargs["start"] = datetime.date.today().isoformat() if kwargs.get("due") in ["now", "today"]: kwargs["due"] = datetime.date.today().isoformat() if kwargs.get("cf") is None: kwargs["cf"] = [] try: issue = redmine.create_issue(**kwargs) except HTTPError as e: click.echo(click.style(f"Fatal: {e}", fg="red")) content = json.loads(e.response.content) if "errors" in content: for i, error in enumerate(content["errors"]): click.echo(click.style(f"ERROR {i}: {error}", fg="red")) sys.exit(1) click.echo(Issue(**issue).as_row())
def _main(): parser = ArgumentParser() parser.add_argument('-i', '--issue', type=int, required=True, dest="issue", help='issue identifier, IE: #1234') args = parser.parse_args() issue = Issue(args.issue) _merge_patches(issue)
def show(redmine, issue_id, journals): """ Show issue details """ issue = redmine.get_issue(issue_id, journals) click.echo( Issue(**issue, statuses=redmine.statuses, priorities=redmine.priorities, users=redmine.users))
def issues(ctx, redmine, **kwargs): """ List issues """ if ctx.parent.alias: kwargs.update(ctx.parent.params) issues = redmine.get_issues(**kwargs) for issue in issues: click.echo(Issue(**issue).as_row())
def me(ctx, redmine, **kwargs): """ List issues assigned to requester """ if not redmine.me: return click.echo("redmine: Please add your user" \ "id to use `me` command") if ctx.parent.alias: kwargs.update(ctx.parent.params) issues = redmine.get_issues(assignee=redmine.me, **kwargs) for issue in issues: click.echo(Issue(**issue).as_row())
def issues(ctx, redmine, issue_ids, **kwargs): """ List issues """ if ctx.parent.alias: kwargs.update(ctx.parent.params) if issue_ids: kwargs.update({"issue_id": ",".join(issue_ids)}) try: issues = redmine.get_issues(**kwargs) except HTTPError as e: return click.echo(click.style(f"Fatal: {e}", fg="red")) if kwargs.get("json"): return click.echo(json.dumps(issues)) for issue in issues: click.echo(Issue(**issue).as_row())
def create(ctx, redmine, *args, **kwargs): """ Create new issue """ if ctx.parent.alias: kwargs.update(ctx.parent.params) if kwargs.get("edit"): kwargs["description"] = get_description() if kwargs.get("start") in ["now", "today"]: kwargs["start"] = datetime.date.today().isoformat() if kwargs.get("due") in ["now", "today"]: kwargs["due"] = datetime.date.today().isoformat() try: issue = redmine.create_issue(**kwargs) except HTTPError as e: return click.echo(click.style(f"Fatal: {e}", fg="red")) click.echo(Issue(**issue).as_row())
def show(redmine, issue_id, journals, pager): """ Show issue details """ try: issue = redmine.get_issue(issue_id, journals) except HTTPError as e: return click.echo(click.style(f"Fatal: {e}", fg="red")) try: issue = Issue( **issue, statuses=redmine.statuses, priorities=redmine.priorities, projects=redmine.projects, users=redmine.users, ) if pager: click.echo_via_pager(str(issue)) else: click.echo(str(issue)) except KeyError: return click.echo( click.style(f"Cache is obsolete. Run with --force.", fg="red") )
def create(redmine, *args, **kwargs): """ Create new issue """ issue = redmine.create_issue(**kwargs) click.echo(Issue(**issue).as_row())
def _fetch_patches(id, chunk): issue = Issue(id) try: issue.get_attachments(chunk) except Exception as err: print 'Stopped suddently: %s' % str(err)
def _fetch_patches(id, chunk): issue = Issue(id) try: issue.get_attachments(chunk) except Exception as err: print 'Stopped suddently: %s' % str(err)