Show More
@@ -303,7 +303,6 class patchheader(object): | |||||
303 | for c in self.comments)) |
|
303 | for c in self.comments)) | |
304 |
|
304 | |||
305 | def setuser(self, user): |
|
305 | def setuser(self, user): | |
306 | if not self.updateheader(['From: ', '# User '], user): |
|
|||
307 |
|
|
306 | try: | |
308 |
|
|
307 | inserthgheader(self.comments, '# User ', user) | |
309 |
|
|
308 | except ValueError: | |
@@ -315,7 +314,6 class patchheader(object): | |||||
315 | self.user = user |
|
314 | self.user = user | |
316 |
|
315 | |||
317 | def setdate(self, date): |
|
316 | def setdate(self, date): | |
318 | if not self.updateheader(['Date: ', '# Date '], date): |
|
|||
319 |
|
|
317 | try: | |
320 |
|
|
318 | inserthgheader(self.comments, '# Date ', date) | |
321 |
|
|
319 | except ValueError: | |
@@ -327,8 +325,6 class patchheader(object): | |||||
327 | self.date = date |
|
325 | self.date = date | |
328 |
|
326 | |||
329 | def setparent(self, parent): |
|
327 | def setparent(self, parent): | |
330 | if not (self.updateheader(['# Parent '], parent) or |
|
|||
331 | self.updateheader(['# Parent '], parent)): |
|
|||
332 |
|
|
328 | try: | |
333 |
|
|
329 | inserthgheader(self.comments, '# Parent ', parent) | |
334 |
|
|
330 | except ValueError: | |
@@ -346,18 +342,6 class patchheader(object): | |||||
346 | self.comments.append('') |
|
342 | self.comments.append('') | |
347 | self.comments.append(message) |
|
343 | self.comments.append(message) | |
348 |
|
344 | |||
349 | def updateheader(self, prefixes, new): |
|
|||
350 | '''Update all references to a field in the patch header. |
|
|||
351 | Return whether the field is present.''' |
|
|||
352 | res = False |
|
|||
353 | for prefix in prefixes: |
|
|||
354 | for i in xrange(len(self.comments)): |
|
|||
355 | if self.comments[i].startswith(prefix): |
|
|||
356 | self.comments[i] = prefix + new |
|
|||
357 | res = True |
|
|||
358 | break |
|
|||
359 | return res |
|
|||
360 |
|
||||
361 | def __str__(self): |
|
345 | def __str__(self): | |
362 | s = '\n'.join(self.comments).rstrip() |
|
346 | s = '\n'.join(self.comments).rstrip() | |
363 | if not s: |
|
347 | if not s: |
General Comments 0
You need to be logged in to leave comments.
Login now