comparison mercurial/patch.py @ 26559:dbd4392daedf

extract: parse 'branch' using the generic mechanism Parsing 'branch' is very simple and a good first test.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 06 Oct 2015 02:22:23 -0700
parents fe52cd049f01
children 75d448d56a9d
comparison
equal deleted inserted replaced
26558:fe52cd049f01 26559:dbd4392daedf
151 # if we are here, we have a very plain patch 151 # if we are here, we have a very plain patch
152 return remainder(cur) 152 return remainder(cur)
153 153
154 ## Some facility for extensible patch parsing: 154 ## Some facility for extensible patch parsing:
155 # list of pairs ("header to match", "data key") 155 # list of pairs ("header to match", "data key")
156 patchheadermap = [('Date', 'date')] 156 patchheadermap = [('Date', 'date'),
157 ('Branch', 'branch'),
158 ]
157 159
158 def extract(ui, fileobj): 160 def extract(ui, fileobj):
159 '''extract patch from data read from fileobj. 161 '''extract patch from data read from fileobj.
160 162
161 patch can be a normal patch or contained in an email message. 163 patch can be a normal patch or contained in an email message.
232 subject = None 234 subject = None
233 elif hgpatchheader: 235 elif hgpatchheader:
234 if line.startswith('# User '): 236 if line.startswith('# User '):
235 data['user'] = line[7:] 237 data['user'] = line[7:]
236 ui.debug('From: %s\n' % data['user']) 238 ui.debug('From: %s\n' % data['user'])
237 elif line.startswith("# Branch "):
238 data['branch'] = line[9:]
239 elif line.startswith("# Node ID "): 239 elif line.startswith("# Node ID "):
240 data['nodeid'] = line[10:] 240 data['nodeid'] = line[10:]
241 elif line.startswith("# Parent "): 241 elif line.startswith("# Parent "):
242 parents.append(line[9:].lstrip()) 242 parents.append(line[9:].lstrip())
243 elif line.startswith("# "): 243 elif line.startswith("# "):