##// END OF EJS Templates
extract: add some facility for extensible header parsing...
Pierre-Yves David -
r26557:23f3f1cb default
parent child Browse files
Show More
@@ -151,6 +151,10 b' def split(stream):'
151 151 # if we are here, we have a very plain patch
152 152 return remainder(cur)
153 153
154 ## Some facility for extensible patch parsing:
155 # list of pairs ("header to match", "data key")
156 patchheadermap = []
157
154 158 def extract(ui, fileobj):
155 159 '''extract patch from data read from fileobj.
156 160
@@ -238,7 +242,12 b' def extract(ui, fileobj):'
238 242 data['nodeid'] = line[10:]
239 243 elif line.startswith("# Parent "):
240 244 parents.append(line[9:].lstrip())
241 elif not line.startswith("# "):
245 elif line.startswith("# "):
246 for header, key in patchheadermap:
247 prefix = '# %s ' % header
248 if line.startswith(prefix):
249 data[key] = line[len(prefix):]
250 else:
242 251 hgpatchheader = False
243 252 elif line == '---':
244 253 ignoretext = True
General Comments 0
You need to be logged in to leave comments. Login now