1#!/usr/bin/env python 2 3"""Generates a friendly list of changes per language since the last release.""" 4 5import sys 6import os 7 8class Language(object): 9 def __init__(self, name, pathspec): 10 self.name = name 11 self.pathspec = pathspec 12 13languages = [ 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", 23 "src/google/protobuf/compiler/java", 24 ]), 25 Language("Python", [ 26 "python", 27 "src/google/protobuf/compiler/python", 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 47if len(sys.argv) < 2: 48 print("Usage: generate_changelog.py <previous release>") 49 sys.exit(1) 50 51previous = sys.argv[1] 52 53for language in languages: 54 print(language.name) 55 sys.stdout.flush() 56 os.system(("git log --pretty=oneline --abbrev-commit %s...HEAD %s | " + 57 "sed -e 's/^/ - /'") % (previous, " ".join(language.pathspec))) 58 print("") 59 60print("To view a commit on GitHub: " + 61 "https://github.com/protocolbuffers/protobuf/commit/<commit id>") 62