My favorites
▼
|
Sign in
gerrit
Gerrit Code Review
Project Home
Downloads
Wiki
Issues
Source
Export to GitHub
New issue
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
1272
attachment: gitlog2asciidoc.py
(1.5 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import string, re, os, subprocess
# This script generates reformat the output of git log to the
# format of release note.
# Example
#
# * <commit subject>
# +
# <commit message>
#
# Bug: issue 123
# Change-Id: <change id>
# Signed-off-by: <name>
# Expected Output:
#
# * issue 123 <commit subject>
# +
# <commit message>
#
fin = open('gitlog')
fout = open('ReleaseNote', 'w')
subject = ""
message = []
for line in fin:
if re.match('\* ', line) >= 0:
if subject != "":
# Write output
fout.write(subject)
if message != []:
message[-1] = '\n'
for m in message:
fout.write(m)
# Start new commit block
message = []
subject = line
continue
elif re.match('Bug: ', line) >= 0:
subject = subject[:2] + line.replace('Bug:', '').replace('\n',' ') + subject[2:]
elif re.match('Issue: ', line) >= 0:
subject = subject[:2] + line.replace('Issue:', 'issue').replace('\n',' ') + subject[2:]
elif re.match('Change-Id:', line) >= 0:
continue
elif re.match('Signed-off-by:', line) >= 0:
continue
else:
if line == '\n':
if message[-1] != '+\n':
message.append('+\n')
else:
message.append(line)
Powered by
Google Project Hosting