Mercurial > hg
comparison mercurial/patch.py @ 26553:89b806a09a66
extract: move 'date' assignment where it is parsed
There is one setter and no consumer, we can move it there directly.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 06 Oct 2015 02:08:32 -0700 |
parents | 4caf143313a8 |
children | a6d51dcb1823 |
comparison
equal
deleted
inserted
replaced
26552:4caf143313a8 | 26553:89b806a09a66 |
---|---|
186 if not subject and not user: | 186 if not subject and not user: |
187 # Not an email, restore parsed headers if any | 187 # Not an email, restore parsed headers if any |
188 subject = '\n'.join(': '.join(h) for h in msg.items()) + '\n' | 188 subject = '\n'.join(': '.join(h) for h in msg.items()) + '\n' |
189 | 189 |
190 # should try to parse msg['Date'] | 190 # should try to parse msg['Date'] |
191 date = None | |
192 nodeid = None | 191 nodeid = None |
193 parents = [] | 192 parents = [] |
194 | 193 |
195 if subject: | 194 if subject: |
196 if subject.startswith('[PATCH'): | 195 if subject.startswith('[PATCH'): |
231 elif hgpatchheader: | 230 elif hgpatchheader: |
232 if line.startswith('# User '): | 231 if line.startswith('# User '): |
233 user = line[7:] | 232 user = line[7:] |
234 ui.debug('From: %s\n' % user) | 233 ui.debug('From: %s\n' % user) |
235 elif line.startswith("# Date "): | 234 elif line.startswith("# Date "): |
236 date = line[7:] | 235 data['date'] = line[7:] |
237 elif line.startswith("# Branch "): | 236 elif line.startswith("# Branch "): |
238 data['branch'] = line[9:] | 237 data['branch'] = line[9:] |
239 elif line.startswith("# Node ID "): | 238 elif line.startswith("# Node ID "): |
240 nodeid = line[10:] | 239 nodeid = line[10:] |
241 elif line.startswith("# Parent "): | 240 elif line.startswith("# Parent "): |
264 data['message'] = message | 263 data['message'] = message |
265 data['user'] = user | 264 data['user'] = user |
266 tmpfp.close() | 265 tmpfp.close() |
267 if not diffs_seen: | 266 if not diffs_seen: |
268 os.unlink(tmpname) | 267 os.unlink(tmpname) |
269 data['date'] = date | |
270 return data | 268 return data |
271 | 269 |
272 if parents: | 270 if parents: |
273 data['p1'] = parents.pop(0) | 271 data['p1'] = parents.pop(0) |
274 if parents: | 272 if parents: |
275 data['p2'] = parents.pop(0) | 273 data['p2'] = parents.pop(0) |
276 | 274 |
277 data['filename'] = tmpname | 275 data['filename'] = tmpname |
278 data['date'] = date | |
279 data['nodeid'] = nodeid | 276 data['nodeid'] = nodeid |
280 return data | 277 return data |
281 | 278 |
282 class patchmeta(object): | 279 class patchmeta(object): |
283 """Patched file metadata | 280 """Patched file metadata |