generate_changelog.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. "src/google/protobuf/compiler/java",
  20. ]),
  21. Language("Python", [
  22. "python",
  23. "src/google/protobuf/compiler/python",
  24. ]),
  25. Language("JavaScript", [
  26. "js",
  27. "src/google/protobuf/compiler/js",
  28. ]),
  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. if len(sys.argv) < 2:
  47. print("Usage: generate_changelog.py <previous release>")
  48. sys.exit(1)
  49. previous = sys.argv[1]
  50. for language in languages:
  51. print(language.name)
  52. sys.stdout.flush()
  53. os.system(("git log --pretty=oneline --abbrev-commit %s...HEAD %s | " +
  54. "sed -e 's/^/ - /'") % (previous, " ".join(language.pathspec)))
  55. print("")
  56. print("To view a commit on GitHub: " +
  57. "https://github.com/protocolbuffers/protobuf/commit/<commit id>")