Lines Matching refs:self
62 def __init__(self, series, name=None, is_log=False): argument
63 self.skip_blank = False # True to skip a single blank line
64 self.found_test = False # Found a TEST= line
65 self.lines_after_test = 0 # MNumber of lines found after TEST=
66 self.warn = [] # List of warnings we have collected
67 self.linenum = 1 # Output line number we are up to
68 self.in_section = None # Name of start...END section we are in
69 self.notes = [] # Series notes
70 self.section = [] # The current section...END section
71 self.series = series # Info about the patch series
72 self.is_log = is_log # True if indent like git log
73 self.in_change = 0 # Non-zero if we are in a change list
74 self.blank_count = 0 # Number of blank lines stored up
75 self.state = STATE_MSG_HEADER # What state are we in?
76 self.signoff = [] # Contents of signoff line
77 self.commit = None # Current commit
79 def AddToSeries(self, line, name, value): argument
91 self.in_section = name
92 self.skip_blank = False
93 if self.is_log:
94 self.series.AddTag(self.commit, line, name, value)
96 def AddToCommit(self, line, name, value): argument
107 self.in_section = 'commit-' + name
108 self.skip_blank = False
110 def CloseCommit(self): argument
112 if self.commit and self.is_log:
113 self.series.AddCommit(self.commit)
114 self.commit = None
118 if self.in_section == 'cover' and self.is_log:
119 self.series.cover = self.section
120 self.in_section = None
121 self.skip_blank = True
122 self.section = []
124 def ProcessLine(self, line): argument
152 commit_match = re_commit.match(line) if self.is_log else None
154 if self.is_log:
165 if self.state == STATE_PATCH_HEADER:
169 if (self.state == STATE_MSG_HEADER
170 or self.state == STATE_PATCH_SUBJECT):
171 self.state += 1
175 if not self.is_log and self.state == STATE_PATCH_SUBJECT:
176 self.state += 1
178 self.state = STATE_MSG_HEADER
183 self.state == STATE_MSG_HEADER:
186 if self.in_section:
187 self.warn.append("Missing 'END' in section '%s'" % self.in_section)
188 if self.in_section == 'cover':
189 self.series.cover = self.section
190 elif self.in_section == 'notes':
191 if self.is_log:
192 self.series.notes += self.section
193 elif self.in_section == 'commit-notes':
194 if self.is_log:
195 self.commit.notes += self.section
197 self.warn.append("Unknown section '%s'" % self.in_section)
198 self.in_section = None
199 self.skip_blank = True
200 self.section = []
203 if self.in_change:
204 self.warn.append("Missing 'blank line' in section 'Series-changes'")
205 self.in_change = 0
208 if self.in_section:
210 if self.in_section == 'cover':
211 self.series.cover = self.section
212 elif self.in_section == 'notes':
213 if self.is_log:
214 self.series.notes += self.section
215 elif self.in_section == 'commit-notes':
216 if self.is_log:
217 self.commit.notes += self.section
219 self.warn.append("Unknown section '%s'" % self.in_section)
220 self.in_section = None
221 self.skip_blank = True
222 self.section = []
224 self.section.append(line)
227 elif not is_blank and self.state == STATE_PATCH_SUBJECT:
228 self.commit.subject = line
232 self.skip_blank = True
237 self.found_test = True
238 elif self.skip_blank and is_blank:
239 self.skip_blank = False
243 self.in_section = 'cover'
244 self.skip_blank = False
248 self.AddToSeries(line, 'cover-cc', value)
251 elif self.in_change:
254 self.in_change = 0
256 self.in_change = 0
257 out = self.ProcessLine(line)
259 if self.is_log:
260 self.series.AddChange(self.in_change, self.commit, line)
261 self.skip_blank = False
273 (self.commit.hash, line))
274 self.in_change = int(value)
276 self.AddToSeries(line, name, value)
277 self.skip_blank = True
284 self.AddToCommit(line, name, value)
285 self.skip_blank = True
289 self.CloseCommit()
290 self.commit = commit.Commit(commit_match.group(1))
297 self.warn.append("Ignoring %s" % line)
299 self.commit.AddCc(tag_match.group(2).split(','))
305 if (self.is_log or not self.commit or
306 self.commit.CheckDuplicateSignoff(signoff_match.group(1))):
314 self.warn.append('Line %d/%d has space before tab' %
315 (self.linenum, m.start()))
319 self.linenum += 1
320 self.skip_blank = False
321 if self.state == STATE_DIFFS:
327 self.state = STATE_DIFFS
331 log = self.series.MakeChangeLog(self.commit)
333 if self.commit:
334 out += self.commit.notes
336 elif self.found_test:
338 self.lines_after_test += 1
342 def Finalize(self): argument
344 self.CloseCommit()
345 if self.lines_after_test:
346 self.warn.append('Found %d lines after TEST=' %
347 self.lines_after_test)
349 def ProcessStream(self, infd, outfd): argument
366 out = self.ProcessLine(line)
375 self.blank_count += 1
377 if self.blank_count and (line == '-- ' or match):
378 self.warn.append("Found possible blank line(s) at "
380 outfd.write('+\n' * self.blank_count)
382 self.blank_count = 0
383 self.Finalize()