Josh Haberman | a2e7364 | 2016-09-21 14:39:27 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | """Generates a friendly list of changes per language since the last release.""" |
| 4 | |
| 5 | import sys |
| 6 | import os |
| 7 | |
| 8 | class Language(object): |
| 9 | def __init__(self, name, pathspec): |
| 10 | self.name = name |
| 11 | self.pathspec = pathspec |
| 12 | |
| 13 | languages = [ |
| 14 | Language("C++", [ |
| 15 | "':(glob)src/google/protobuf/*'", |
| 16 | "src/google/protobuf/compiler/cpp", |
| 17 | "src/google/protobuf/io", |
| 18 | "src/google/protobuf/util", |
| 19 | "src/google/protobuf/stubs", |
| 20 | ]), |
| 21 | Language("Java", [ |
| 22 | "java", |
Adam Cozzette | c8440a3 | 2018-05-24 15:56:09 -0700 | [diff] [blame] | 23 | "src/google/protobuf/compiler/java", |
Josh Haberman | a2e7364 | 2016-09-21 14:39:27 -0700 | [diff] [blame] | 24 | ]), |
| 25 | Language("Python", [ |
Adam Cozzette | c8440a3 | 2018-05-24 15:56:09 -0700 | [diff] [blame] | 26 | "python", |
Josh Haberman | a2e7364 | 2016-09-21 14:39:27 -0700 | [diff] [blame] | 27 | "src/google/protobuf/compiler/python", |
| 28 | ]), |
Josh Haberman | a2e7364 | 2016-09-21 14:39:27 -0700 | [diff] [blame] | 29 | Language("PHP", [ |
| 30 | "php", |
| 31 | "src/google/protobuf/compiler/php", |
| 32 | ]), |
| 33 | Language("Ruby", [ |
| 34 | "ruby", |
| 35 | "src/google/protobuf/compiler/ruby", |
| 36 | ]), |
| 37 | Language("Csharp", [ |
| 38 | "csharp", |
| 39 | "src/google/protobuf/compiler/csharp", |
| 40 | ]), |
| 41 | Language("Objective C", [ |
| 42 | "objectivec", |
| 43 | "src/google/protobuf/compiler/objectivec", |
| 44 | ]), |
| 45 | ] |
| 46 | |
| 47 | if len(sys.argv) < 2: |
| 48 | print("Usage: generate_changelog.py <previous release>") |
| 49 | sys.exit(1) |
| 50 | |
| 51 | previous = sys.argv[1] |
| 52 | |
| 53 | for language in languages: |
| 54 | print(language.name) |
Josh Haberman | 277a8b6 | 2016-12-09 16:13:18 -0800 | [diff] [blame] | 55 | sys.stdout.flush() |
Josh Haberman | a2e7364 | 2016-09-21 14:39:27 -0700 | [diff] [blame] | 56 | os.system(("git log --pretty=oneline --abbrev-commit %s...HEAD %s | " + |
| 57 | "sed -e 's/^/ - /'") % (previous, " ".join(language.pathspec))) |
| 58 | print("") |
| 59 | |
| 60 | print("To view a commit on GitHub: " + |
Feng Xiao | afe98de | 2018-08-22 11:55:30 -0700 | [diff] [blame] | 61 | "https://github.com/protocolbuffers/protobuf/commit/<commit id>") |