From: Loic Dachary Date: Tue, 21 Jul 2015 16:26:56 +0000 (+0200) Subject: src/script/ceph-release-notes: add --text for plain text output X-Git-Tag: v9.1.0~508^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F5306%2Fhead;p=ceph.git src/script/ceph-release-notes: add --text for plain text output This is a format that's easier to consume when sending a mail. Signed-off-by: Loic Dachary --- diff --git a/src/script/ceph-release-notes b/src/script/ceph-release-notes index 6f96457be3af..e59efd353cac 100755 --- a/src/script/ceph-release-notes +++ b/src/script/ceph-release-notes @@ -3,7 +3,10 @@ # https://gist.github.com/aisrael/b2b78d9dfdd176a232b9 """To run this script first install the dependencies -$ pip install githubpy GitPython + + virtualenv v + source v/bin/activate + pip install githubpy GitPython Generate a github access token; this is needed as the anonymous access to Github's API will easily hit the limit even with a single invocation. @@ -15,7 +18,8 @@ Next either set the github token as an env variable `--token` switch. Example: -ceph_release_notes -r tags/v0.87..giant /path/to/ceph/repo + + ceph-release-notes -r tags/v0.87..origin/giant $(git rev-parse --show-toplevel) """ @@ -35,7 +39,7 @@ tracker_re = re.compile("http://tracker.ceph.com/issues/(\d+)") signed_off_re = re.compile("Signed-off-by: (.+) <") -def make_release_notes(gh, repo, ref): +def make_release_notes(gh, repo, ref, plaintext): issue2prs = {} @@ -75,13 +79,19 @@ def make_release_notes(gh, repo, ref): if len(prs) > 1: print (">>>>>>> " + str(len(prs)) + " pr for issue " + issue) for (author, title, number) in prs: - print ("* {title} (`issue#{issue} `_, `pr#{number} `_, {author})".format(title=title, issue=issue, author=author, number=number)) + if plaintext: + print ("* {title} (#{issue}, {author})".format(title=title, issue=issue, author=author)) + else: + print ("* {title} (`issue#{issue} `_, `pr#{number} `_, {author})".format(title=title, issue=issue, author=author, number=number)) if __name__ == "__main__": parser = argparse.ArgumentParser() 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("repo", metavar="repo", help="path to ceph git repo") parser.add_argument("--token", default=os.getenv("GITHUB_ACCESS_TOKEN"), @@ -91,4 +101,4 @@ if __name__ == "__main__": gh = github.GitHub( access_token=args.token) - make_release_notes(gh, Repo(args.repo), args.rev) + make_release_notes(gh, Repo(args.repo), args.rev, args.text)