`_'
).format(issue=issue), pr2issues[pr]
)
issues = ", ".join(issues) + ", "
else:
issues = ''
if plaintext:
print ("* {title} ({issues}{author})".format(
title=title,
issues=issues,
author=author
)
)
elif html:
print (
(
"{title} ({issues}pr#{pr}, {author})
"
).format(
title=title,
issues=issues,
author=author, pr=pr
)
)
elif markdown:
markdown_title = title.replace('_', '\_').replace('.', '.')
print ("- {title} ({issues}[pr#{pr}](https://github.com/ceph/ceph/pull/{pr}), {author})\n".format(
title=markdown_title,
issues=issues,
author=author, pr=pr
)
)
else:
print (
(
"* {title} ({issues}`pr#{pr} <"
"https://github.com/ceph/ceph/pull/{pr}"
">`_, {author})"
).format(
title=title,
issues=issues,
author=author, pr=pr
)
)
if include_pr_messages and message:
print (message)
if __name__ == "__main__":
desc = '''
Make ceph release notes for a given revision. Eg usage:
$ ceph-release-notes -r tags/v0.87..origin/giant \
$(git rev-parse --show-toplevel)
It is recommended to set the github env. token in order to avoid
hitting the api rate limits.
'''
parser = argparse.ArgumentParser(
description=desc,
formatter_class=argparse.RawTextHelpFormatter
)
parser.add_argument("--rev", "-r",
help="git revision range for creating release notes")
parser.add_argument("--text", "-t",
action='store_true', default=None,
help="output plain text only, no links")
parser.add_argument("--html",
action='store_true', default=None,
help="output html format for (old wordpress) website blog")
parser.add_argument("--markdown",
action='store_true', default=None,
help="output markdown format for new ceph.io blog")
parser.add_argument("--verbose", "-v",
action='store_true', default=None,
help="verbose")
parser.add_argument("--strict",
action='store_true', default=None,
help="strict, recommended only for backport releases")
parser.add_argument("repo", metavar="repo",
help="path to ceph git repo")
parser.add_argument(
"--token",
default=os.getenv("GITHUB_ACCESS_TOKEN"),
help="Github Access Token ($GITHUB_ACCESS_TOKEN otherwise)",
)
parser.add_argument("--use-tags", default=False,
help="Use github tags to guess the component")
parser.add_argument("--include-pr-messages", default=False, action='store_true',
help="Include full PR message in addition to PR title, if available")
args = parser.parse_args()
gh = github.GitHub(
access_token=args.token)
make_release_notes(
gh,
Repo(args.repo),
args.rev,
args.text,
args.html,
args.markdown,
args.verbose,
args.strict,
args.use_tags,
args.include_pr_messages
)