]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - debian/scripts/misc/git-ubuntu-log
12 sys
.stdout
= codecs
.getwriter("utf-8")(sys
.stdout
.detach())
14 # Suck up the git log output and extract the information we need.
19 for line
in sys
.stdin
:
20 if line
.startswith('commit '):
21 if entry
and 'ignore' not in entry
:
26 elif line
.startswith('Author: '):
27 bits
= line
.strip().split(maxsplit
=1)
28 entry
['author'] = bits
[1]
30 elif subject_wait
and line
.startswith(' '):
32 entry
['subject'] = line
.strip()
34 elif line
.startswith(' BugLink: ') and 'launchpad.net' in line
:
35 bits
= line
.strip().split(maxsplit
=1)
36 bits
= bits
[1].split('/')
37 entry
.setdefault('bugs', []).append(bits
[-1])
39 # Accumulate bug numbers.
40 if bits
[-1] not in bugs
:
43 elif line
.startswith(' Ignore:'):
44 entry
['ignore'] = True
49 # Go through the entries and clear out authors for upstream commits.
51 if entry
['subject'].startswith('UBUNTU:'):
52 entry
['subject'] = entry
['subject'][7:].strip()
56 # Lump everything without a bug at the bottom.
57 bugs
.append('__packaging__')
58 bugs
.append('__mainline__')
62 if bug
== '__packaging__':
63 title
= 'Miscellaneous Ubuntu changes'
64 elif bug
== '__mainline__':
65 title
= 'Miscellaneous upstream changes'
70 #urllib.request.urlcleanup()
71 request
= urllib
.request
.Request('https://api.launchpad.net/devel/bugs/' + bug
)
72 request
.add_header('Cache-Control', 'max-age=0')
73 with urllib
.request
.urlopen(request
) as response
:
74 data
= response
.read()
75 bug_info
= json
.loads(data
.decode('utf-8'))
77 title
= bug_info
['title']
78 if 'description' in bug_info
:
79 for line
in bug_info
['description'].split('\n'):
80 if line
.startswith('Kernel-Description:'):
81 title
= line
.split(' ', 1)[1]
83 except urllib
.error
.HTTPError
:
84 title
= 'INVALID or PRIVATE BUG'
86 title
+= ' (LP: #' + bug
+ ')'
90 if (bug
== '__packaging__' and 'bugs' not in entry
and 'author' in entry
) or \
91 (bug
== '__mainline__' and 'bugs' not in entry
and 'author' not in entry
) or \
92 ('bugs' in entry
and bug
in entry
['bugs']):
98 title_lines
= textwrap
.wrap(title
, 76)
99 print(' * ' + title_lines
[0])
100 for line
in title_lines
[1:]:
104 title_lines
= textwrap
.wrap(entry
['subject'], 76)
105 print(' - ' + title_lines
[0])
106 for line
in title_lines
[1:]: