##// END OF EJS Templates
phabricator: add node and p1 to hg:meta property...
Jun Wu -
r33264:26632157 default
parent child Browse files
Show More
@@ -196,6 +196,8 b' def writediffproperties(ctx, diff):'
196 196 'data': json.dumps({
197 197 'user': ctx.user(),
198 198 'date': '%d %d' % ctx.date(),
199 'node': ctx.hex(),
200 'parent': ctx.p1().hex(),
199 201 }),
200 202 }
201 203 callconduit(ctx.repo(), 'differential.setdiffproperty', params)
@@ -292,6 +294,11 b' def phabsend(ui, repo, *revs, **opts):'
292 294
293 295 _summaryre = re.compile('^Summary:\s*', re.M)
294 296
297 # Map from "hg:meta" keys to header understood by "hg import". The order is
298 # consistent with "hg export" output.
299 _metanamemap = util.sortdict([(r'user', 'User'), (r'date', 'Date'),
300 (r'node', 'Node ID'), (r'parent', 'Parent ')])
301
295 302 def readpatch(repo, params, recursive=False):
296 303 """generate plain-text patch readable by 'hg import'
297 304
@@ -316,13 +323,16 b' def readpatch(repo, params, recursive=Fa'
316 323 # Remove potential empty "Summary:"
317 324 desc = _summaryre.sub('', desc)
318 325
319 # Try to preserve metadata (user, date) from hg:meta property
326 # Try to preserve metadata from hg:meta property. Write hg patch headers
327 # that can be read by the "import" command. See patchheadermap and extract
328 # in mercurial/patch.py for supported headers.
320 329 diffs = callconduit(repo, 'differential.querydiffs', {'ids': [diffid]})
321 330 props = diffs[str(diffid)][r'properties'] # could be empty list or dict
322 331 if props and r'hg:meta' in props:
323 332 meta = props[r'hg:meta']
324 for k, v in meta.items():
325 header += '# %s %s\n' % (k.capitalize(), v)
333 for k in _metanamemap.keys():
334 if k in meta:
335 header += '# %s %s\n' % (_metanamemap[k], meta[k])
326 336
327 337 patch = ('%s%s\n%s') % (header, desc, body)
328 338
General Comments 0
You need to be logged in to leave comments. Login now