Show More
@@ -202,7 +202,11 b' class patchheader(object):' | |||||
202 | self.nodeid = nodeid |
|
202 | self.nodeid = nodeid | |
203 | self.branch = branch |
|
203 | self.branch = branch | |
204 | self.haspatch = diffstart > 1 |
|
204 | self.haspatch = diffstart > 1 | |
205 | self.plainmode = plainmode |
|
205 | self.plainmode = (plainmode or | |
|
206 | '# HG changeset patch' not in self.comments and | |||
|
207 | util.any(c.startswith('Date: ') or | |||
|
208 | c.startswith('From: ') | |||
|
209 | for c in self.comments)) | |||
206 |
|
210 | |||
207 | def setuser(self, user): |
|
211 | def setuser(self, user): | |
208 | if not self.updateheader(['From: ', '# User '], user): |
|
212 | if not self.updateheader(['From: ', '# User '], user): | |
@@ -210,7 +214,7 b' class patchheader(object):' | |||||
210 | patchheaderat = self.comments.index('# HG changeset patch') |
|
214 | patchheaderat = self.comments.index('# HG changeset patch') | |
211 | self.comments.insert(patchheaderat + 1, '# User ' + user) |
|
215 | self.comments.insert(patchheaderat + 1, '# User ' + user) | |
212 | except ValueError: |
|
216 | except ValueError: | |
213 |
if self.plainmode |
|
217 | if self.plainmode: | |
214 | self.comments = ['From: ' + user] + self.comments |
|
218 | self.comments = ['From: ' + user] + self.comments | |
215 | else: |
|
219 | else: | |
216 | tmp = ['# HG changeset patch', '# User ' + user] |
|
220 | tmp = ['# HG changeset patch', '# User ' + user] | |
@@ -223,7 +227,7 b' class patchheader(object):' | |||||
223 | patchheaderat = self.comments.index('# HG changeset patch') |
|
227 | patchheaderat = self.comments.index('# HG changeset patch') | |
224 | self.comments.insert(patchheaderat + 1, '# Date ' + date) |
|
228 | self.comments.insert(patchheaderat + 1, '# Date ' + date) | |
225 | except ValueError: |
|
229 | except ValueError: | |
226 |
if self.plainmode |
|
230 | if self.plainmode: | |
227 | self.comments = ['Date: ' + date] + self.comments |
|
231 | self.comments = ['Date: ' + date] + self.comments | |
228 | else: |
|
232 | else: | |
229 | tmp = ['# HG changeset patch', '# Date ' + date] |
|
233 | tmp = ['# HG changeset patch', '# Date ' + date] | |
@@ -258,14 +262,6 b' class patchheader(object):' | |||||
258 | break |
|
262 | break | |
259 | return res |
|
263 | return res | |
260 |
|
264 | |||
261 | def _hasheader(self, prefixes): |
|
|||
262 | '''Check if a header starts with any of the given prefixes.''' |
|
|||
263 | for prefix in prefixes: |
|
|||
264 | for comment in self.comments: |
|
|||
265 | if comment.startswith(prefix): |
|
|||
266 | return True |
|
|||
267 | return False |
|
|||
268 |
|
||||
269 | def __str__(self): |
|
265 | def __str__(self): | |
270 | s = '\n'.join(self.comments).rstrip() |
|
266 | s = '\n'.join(self.comments).rstrip() | |
271 | if not s: |
|
267 | if not s: |
General Comments 0
You need to be logged in to leave comments.
Login now