1 | #!/usr/bin/env python |
---|
2 | # -*- coding: utf-8 -*- |
---|
3 | |
---|
4 | from webkitpy.common.checkout.scm import default_scm |
---|
5 | from webkitpy.common.checkout.checkout import Checkout |
---|
6 | from webkitpy.common.system.executive import Executive |
---|
7 | from webkitpy.common.net.bugzilla import Bugzilla |
---|
8 | from xml.sax.saxutils import unescape |
---|
9 | import sys |
---|
10 | import os |
---|
11 | |
---|
12 | scm = default_scm() |
---|
13 | |
---|
14 | gtk_dirs = ['gtk', 'gobject', 'soup', 'cairo', 'gstreamer'] |
---|
15 | log_dirs = [] |
---|
16 | for root, dirs, dummy in os.walk(scm.checkout_root): |
---|
17 | for d in dirs: |
---|
18 | if d in gtk_dirs: |
---|
19 | log_dirs.append(os.path.join(root, d)) |
---|
20 | |
---|
21 | command = ['git', 'log', '--pretty=%H', sys.argv[1] + '..', '--'] |
---|
22 | command.extend (log_dirs) |
---|
23 | revisions = Executive().run_command(command).splitlines() |
---|
24 | |
---|
25 | co = Checkout(scm) |
---|
26 | bugs = {} |
---|
27 | for rev in revisions: |
---|
28 | info = co.commit_info_for_revision(scm.svn_revision_from_git_commit(rev)) |
---|
29 | if not info: |
---|
30 | print "Error: no commit info found for git revision %s" % (rev) |
---|
31 | continue |
---|
32 | bug_id = info.bug_id() |
---|
33 | if bug_id: |
---|
34 | author_name = info.author_name() |
---|
35 | authors = bugs.setdefault(bug_id, []) |
---|
36 | if author_name not in authors: |
---|
37 | authors.append(author_name) |
---|
38 | |
---|
39 | bugzilla = Bugzilla() |
---|
40 | for bug_id in bugs: |
---|
41 | try: |
---|
42 | bug_title = bugzilla.fetch_bug_dictionary(bug_id)['title'] |
---|
43 | except: |
---|
44 | print "Error getting info for bug #%s" % (bug_id) |
---|
45 | continue |
---|
46 | bug_title = unescape(bug_title, {"'": "'", """: '"'}) |
---|
47 | print u"Bug %s – %s (%s)" % (bug_id, bug_title, ", ".join (bugs[bug_id])) |
---|