elif commit_match:
self.state = STATE_MSG_HEADER
- # If a tag is detected
+ # If a tag is detected, or a new commit starts
if series_tag_match or commit_tag_match or \
- cover_match or cover_cc_match or signoff_match:
+ cover_match or cover_cc_match or signoff_match or \
+ self.state == STATE_MSG_HEADER:
# but we are already in a section, this means 'END' is missing
# for that section, fix it up.
if self.in_section:
# Well that means this is an ordinary line
else:
- pos = 1
- # Look for ugly ASCII characters
- for ch in line:
- # TODO: Would be nicer to report source filename and line
- if ord(ch) > 0x80:
- self.warn.append("Line %d/%d ('%s') has funny ascii char" %
- (self.linenum, pos, line))
- pos += 1
-
# Look for space before tab
m = re_space_before_tab.match(line)
if m:
"""
return GetMetaDataForList('HEAD~%d' % start, None, count)
+def GetMetaDataForTest(text):
+ """Process metadata from a file containing a git log. Used for tests
+
+ Args:
+ text:
+ """
+ series = Series()
+ ps = PatchStream(series, is_log=True)
+ for line in text.splitlines():
+ ps.ProcessLine(line)
+ ps.Finalize()
+ return series
+
def FixPatch(backup_dir, fname, series, commit):
"""Fix up a patch file, by adding/removing as required.
commit.patch = fname
result = FixPatch(backup_dir, fname, series, commit)
if result:
- print '%d warnings for %s:' % (len(result), fname)
+ print('%d warnings for %s:' % (len(result), fname))
for warn in result:
- print '\t', warn
+ print('\t', warn)
print
count += 1
- print 'Cleaned %d patches' % count
- return series
+ print('Cleaned %d patches' % count)
def InsertCoverLetter(fname, series, count):
"""Inserts a cover letter with the required info into patch 0