0089156ac5be66fbdceb0b293b0c83df366272d5
[vpp.git] / extras / scripts / list_api_changes.py
1 #!/usr/bin/env python
2 import os, fnmatch, subprocess
3
4 starttag = 'v18.04-rc0'
5 endtag = 'v18.04-rc2'
6 emit_md = True
7 apifiles = []
8
9 for root, dirnames, filenames in os.walk('.'):
10     for filename in fnmatch.filter(filenames, '*.api'):
11         apifiles.append(os.path.join(root, filename))
12
13 for f in apifiles:
14     commits = subprocess.check_output(['git', 'log',
15                                        '--oneline', starttag + '..' + endtag,
16                                        f])
17     if commits:
18         if f[0:2] == './':
19             f = f[2:]
20         if emit_md:
21             print "| @c %s ||" % f
22             print "| ------- | ------- |"
23             for line in commits.splitlines():
24                 parts = line.strip().split()
25                 commit = parts[0]
26                 message = " ".join(parts[1:]).replace("|", "\|")
27                 print "| [%s](https://gerrit.fd.io/r/gitweb?" \
28                         "p=vpp.git;a=commit;h=%s) | %s |" % (
29                                 commit, commit, message)
30             print
31         else:
32             print f
33             print commits