Allow introductory text in commit log and ignore it when generating ChangeLog

* gen-changelog.py (process_commit): Everything that comes between
	the subject line of the commit and the first \t* sequence is
	considered to be introductory text.  Ignore it when generating the
	ChangeLog entry.
	* COMMIT-LOG-GUIDELINES: Update the commit log guidelines to
	reflect the fact that we can now have introductory text in the
	commit log.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2014-11-18 15:34:22 +01:00
parent 1429a63417
commit 71aba18621
2 changed files with 43 additions and 4 deletions

View File

@ -24,6 +24,15 @@ The line in its entirety should not be longer than 50 characters.
The next line should be an empty line, with no spaces.
Subsequent lines can be a free form introductory text that should
start column 0. The introductory text can have an arbitrary number of
lines. No line in that text should start with the sequence
<white-space>*. That is, no line in that text should start with a
sequence of white spaces followed by the start character (*).
If there was an introductory text, then the next line should be an
empty line, with no spaces.
The subsequent lines should have the form of the Body of a GNU ChangeLog
entry, i.e:
@ -44,5 +53,21 @@ PR 123456 Shorten compilation lines
* tests/Makefile.am: Adjust this.
~=~
Another one could be:
~=~
PR 123456 Shorten compilation lines
Blah blah, this is an introductory text explaining the purpose of this
commit. It can contain whatever character I want. It just cannot
contain a line that starts with white spaces immediately followed by
the star character.
* configure.ac: Shorten compilation lines by regrouping
PKG_CHECK_MODULES calls.
* tests/Makefile.am: Adjust this.
~=~
We encourage you to look at the existing commit logs or at the
ChangeLog file for inspiration.
ChangeLog file for inspiration.

View File

@ -51,6 +51,13 @@ def process_commit(lines, files):
break
top_line = lines[0]
subject_line_index = 0 if lines[1].startswith('*') else 1;
first_cl_body_line_index = 0;
for i in range(1, len(lines)):
if lines[i].startswith('*'):
first_cl_body_line_index = i
break;
# Clean up top line of ChangeLog entry:
fields = top_line.split(' ')
@ -71,9 +78,16 @@ def process_commit(lines, files):
if not fileincommit:
for f in files:
print '\t* %s:' % f
for l in lines[1:]:
print '\t ', l
print
if subject_line_index > 0:
print '\t', lines[subject_line_index]
if first_cl_body_line_index > 0:
for l in lines[first_cl_body_line_index:]:
if l.startswith('Signed-off-by:'):
continue
print '\t', l
print
def output_commits():
cmd = ['git', 'log', '--pretty=format:--START-COMMIT--%H%n%ai %an <%ae>%n%n%s%n%b%n--END-COMMIT--',