378 def writediffproperties(ctx, diff): |
379 def writediffproperties(ctx, diff): |
379 """write metadata to diff so patches could be applied losslessly""" |
380 """write metadata to diff so patches could be applied losslessly""" |
380 params = { |
381 params = { |
381 b'diff_id': diff[b'id'], |
382 b'diff_id': diff[b'id'], |
382 b'name': b'hg:meta', |
383 b'name': b'hg:meta', |
383 b'data': json.dumps({ |
384 b'data': templatefilters.json({ |
384 u'user': encoding.unifromlocal(ctx.user()), |
385 b'user': ctx.user(), |
385 u'date': u'{:.0f} {}'.format(*ctx.date()), |
386 b'date': b'%d %d' % ctx.date(), |
386 u'node': encoding.unifromlocal(ctx.hex()), |
387 b'node': ctx.hex(), |
387 u'parent': encoding.unifromlocal(ctx.p1().hex()), |
388 b'parent': ctx.p1().hex(), |
388 }), |
389 }), |
389 } |
390 } |
390 callconduit(ctx.repo(), b'differential.setdiffproperty', params) |
391 callconduit(ctx.repo(), b'differential.setdiffproperty', params) |
391 |
392 |
392 params = { |
393 params = { |
393 b'diff_id': diff[b'id'], |
394 b'diff_id': diff[b'id'], |
394 b'name': b'local:commits', |
395 b'name': b'local:commits', |
395 b'data': json.dumps({ |
396 b'data': templatefilters.json({ |
396 encoding.unifromlocal(ctx.hex()): { |
397 ctx.hex(): { |
397 u'author': encoding.unifromlocal(stringutil.person(ctx.user())), |
398 b'author': stringutil.person(ctx.user()), |
398 u'authorEmail': encoding.unifromlocal( |
399 b'authorEmail': stringutil.email(ctx.user()), |
399 stringutil.email(ctx.user())), |
400 b'time': b'%d' % ctx.date()[0], |
400 u'time': u'{:.0f}'.format(ctx.date()[0]), |
|
401 }, |
401 }, |
402 }), |
402 }), |
403 } |
403 } |
404 callconduit(ctx.repo(), b'differential.setdiffproperty', params) |
404 callconduit(ctx.repo(), b'differential.setdiffproperty', params) |
405 |
405 |