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("JavaScript", [
30      "js",
31      "src/google/protobuf/compiler/js",
32  ]),
33  Language("PHP", [
34      "php",
35      "src/google/protobuf/compiler/php",
36  ]),
37  Language("Ruby", [
38      "ruby",
39      "src/google/protobuf/compiler/ruby",
40  ]),
41  Language("Csharp", [
42      "csharp",
43      "src/google/protobuf/compiler/csharp",
44  ]),
45  Language("Objective C", [
46      "objectivec",
47      "src/google/protobuf/compiler/objectivec",
48  ]),
49]
50
51if len(sys.argv) < 2:
52  print("Usage: generate_changelog.py <previous release>")
53  sys.exit(1)
54
55previous = sys.argv[1]
56
57for language in languages:
58  print(language.name)
59  sys.stdout.flush()
60  os.system(("git log --pretty=oneline --abbrev-commit %s...HEAD %s | " +
61             "sed -e 's/^/ - /'") % (previous, " ".join(language.pathspec)))
62  print("")
63
64print("To view a commit on GitHub: " +
65      "https://github.com/protocolbuffers/protobuf/commit/<commit id>")
66