generate_changelog.py 1.5 KB

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