Mercurial > hg
comparison mercurial/patch.py @ 26560:75d448d56a9d
extract: parse 'nodeid' using the generic mechanism
Parsing 'nodeid' is very simple and a good first test.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 06 Oct 2015 02:23:21 -0700 |
parents | dbd4392daedf |
children | 56b2bcea2529 |
comparison
equal
deleted
inserted
replaced
26559:dbd4392daedf | 26560:75d448d56a9d |
---|---|
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'), | 157 ('Branch', 'branch'), |
158 ('Node ID', 'nodeid'), | |
158 ] | 159 ] |
159 | 160 |
160 def extract(ui, fileobj): | 161 def extract(ui, fileobj): |
161 '''extract patch from data read from fileobj. | 162 '''extract patch from data read from fileobj. |
162 | 163 |
234 subject = None | 235 subject = None |
235 elif hgpatchheader: | 236 elif hgpatchheader: |
236 if line.startswith('# User '): | 237 if line.startswith('# User '): |
237 data['user'] = line[7:] | 238 data['user'] = line[7:] |
238 ui.debug('From: %s\n' % data['user']) | 239 ui.debug('From: %s\n' % data['user']) |
239 elif line.startswith("# Node ID "): | |
240 data['nodeid'] = line[10:] | |
241 elif line.startswith("# Parent "): | 240 elif line.startswith("# Parent "): |
242 parents.append(line[9:].lstrip()) | 241 parents.append(line[9:].lstrip()) |
243 elif line.startswith("# "): | 242 elif line.startswith("# "): |
244 for header, key in patchheadermap: | 243 for header, key in patchheadermap: |
245 prefix = '# %s ' % header | 244 prefix = '# %s ' % header |