Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.py @ 26554:a6d51dcb1823
extract: move 'nodeid' assignment where it is parsed
The is one setter and no consumer, we can move it there directly.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 07 Oct 2015 00:50:53 -0700 |
parents | 89b806a09a66 |
children | 1e33384ff2ed |
comparison
equal
deleted
inserted
replaced
26553:89b806a09a66 | 26554:a6d51dcb1823 |
---|---|
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 nodeid = None | |
192 parents = [] | 191 parents = [] |
193 | 192 |
194 if subject: | 193 if subject: |
195 if subject.startswith('[PATCH'): | 194 if subject.startswith('[PATCH'): |
196 pend = subject.find(']') | 195 pend = subject.find(']') |
234 elif line.startswith("# Date "): | 233 elif line.startswith("# Date "): |
235 data['date'] = line[7:] | 234 data['date'] = line[7:] |
236 elif line.startswith("# Branch "): | 235 elif line.startswith("# Branch "): |
237 data['branch'] = line[9:] | 236 data['branch'] = line[9:] |
238 elif line.startswith("# Node ID "): | 237 elif line.startswith("# Node ID "): |
239 nodeid = line[10:] | 238 data['nodeid'] = line[10:] |
240 elif line.startswith("# Parent "): | 239 elif line.startswith("# Parent "): |
241 parents.append(line[9:].lstrip()) | 240 parents.append(line[9:].lstrip()) |
242 elif not line.startswith("# "): | 241 elif not line.startswith("# "): |
243 hgpatchheader = False | 242 hgpatchheader = False |
244 elif line == '---': | 243 elif line == '---': |
271 data['p1'] = parents.pop(0) | 270 data['p1'] = parents.pop(0) |
272 if parents: | 271 if parents: |
273 data['p2'] = parents.pop(0) | 272 data['p2'] = parents.pop(0) |
274 | 273 |
275 data['filename'] = tmpname | 274 data['filename'] = tmpname |
276 data['nodeid'] = nodeid | |
277 return data | 275 return data |
278 | 276 |
279 class patchmeta(object): | 277 class patchmeta(object): |
280 """Patched file metadata | 278 """Patched file metadata |
281 | 279 |