comparison mercurial/patch.py @ 43097:27c4f93d07a9

import: read X-Mercurial-Node email header to determine nodeid This would be useful to import and obsolete patches sent using 'hg email --plain', using evolve's --obsolete option of 'hg import'. If email body contains Mercurial patch header ('# HG changeset patch' block), nodeid parsed from X-Mercurial-Node header will still be overridden by respective value found in body.
author Denis Laxalde <denis@laxalde.org>
date Sun, 06 Oct 2019 13:06:19 +0200
parents eef9a2d67051
children 74802979dd9d
comparison
equal deleted inserted replaced
43096:813aa8cc55d4 43097:27c4f93d07a9
253 + b'\n' 253 + b'\n'
254 ) 254 )
255 255
256 # should try to parse msg['Date'] 256 # should try to parse msg['Date']
257 parents = [] 257 parents = []
258
259 nodeid = msg[r'X-Mercurial-Node']
260 if nodeid:
261 data[b'nodeid'] = nodeid = mail.headdecode(nodeid)
262 ui.debug(b'Node ID: %s\n' % nodeid)
258 263
259 if subject: 264 if subject:
260 if subject.startswith(b'[PATCH'): 265 if subject.startswith(b'[PATCH'):
261 pend = subject.find(b']') 266 pend = subject.find(b']')
262 if pend >= 0: 267 if pend >= 0: