Beispiel #1
0
def changelog(ctx, input, releasename):
    """
    Generates a changelog for the given issues.
    """
    helpers.exitIfNoHost(ctx)
    jira = JiraHelper(ctx.obj['host'], ctx.obj['user'], ctx.obj['password'])

    issueKeys = helpers.readIssuesFromInput(input)
    issues = helpers.getIssuesOrExit(jira, issueKeys)

    sortedIssues = {}
    sortedIssues['features'] = []
    sortedIssues['bugs'] = []
    sortedIssues['others'] = []

    # Sort issues by type
    for issue in issues:
        issueType = str(issue.fields.issuetype).lower()
        if issueType in ISSUE_TYPE_MAPPING['features']:
            sortedIssues['features'].append(issue)
        elif issueType in ISSUE_TYPE_MAPPING['bugs']:
            sortedIssues['bugs'].append(issue)
        else:
            sortedIssues['others'].append(issue)

    meta = {
            'jira': jira.host,
            'date': time.strftime('%d-%m-%Y', time.gmtime()),
            'releasename': releasename
        }
    output = helpers.compileChangelogTemplate(sortedIssues['features'], sortedIssues['bugs'], sortedIssues['others'], meta)
    click.echo(output)
Beispiel #2
0
def emailreleaselog(ctx, input):
    """Generates a changelog for the release email."""
    helpers.exitIfNoHost(ctx)
    jira = JiraHelper(ctx.obj['host'], ctx.obj['user'], ctx.obj['password'])

    issueNumbers = helpers.readIssuesFromInput(input)
    issues = helpers.getIssuesOrExit(jira, issueNumbers)

    data = []
    for issue in issues:
        link = jira.host + '/browse/' + issue.key
        data.append({'key': issue.key, 'link': link, 'summary': issue.fields.summary})

    output = helpers.compileEmailTemplate(data)
    click.echo(output)