369 """write metadata to diff so patches could be applied losslessly""" |
369 """write metadata to diff so patches could be applied losslessly""" |
370 params = { |
370 params = { |
371 b'diff_id': diff[b'id'], |
371 b'diff_id': diff[b'id'], |
372 b'name': b'hg:meta', |
372 b'name': b'hg:meta', |
373 b'data': json.dumps({ |
373 b'data': json.dumps({ |
374 b'user': ctx.user(), |
374 u'user': encoding.unifromlocal(ctx.user()), |
375 b'date': b'%d %d' % ctx.date(), |
375 u'date': u'{:.0f} {}'.format(*ctx.date()), |
376 b'node': ctx.hex(), |
376 u'node': encoding.unifromlocal(ctx.hex()), |
377 b'parent': ctx.p1().hex(), |
377 u'parent': encoding.unifromlocal(ctx.p1().hex()), |
378 }), |
378 }), |
379 } |
379 } |
380 callconduit(ctx.repo(), b'differential.setdiffproperty', params) |
380 callconduit(ctx.repo(), b'differential.setdiffproperty', params) |
381 |
381 |
382 params = { |
382 params = { |
383 b'diff_id': diff[b'id'], |
383 b'diff_id': diff[b'id'], |
384 b'name': b'local:commits', |
384 b'name': b'local:commits', |
385 b'data': json.dumps({ |
385 b'data': json.dumps({ |
386 ctx.hex(): { |
386 encoding.unifromlocal(ctx.hex()): { |
387 b'author': stringutil.person(ctx.user()), |
387 u'author': encoding.unifromlocal(stringutil.person(ctx.user())), |
388 b'authorEmail': stringutil.email(ctx.user()), |
388 u'authorEmail': encoding.unifromlocal( |
389 b'time': ctx.date()[0], |
389 stringutil.email(ctx.user())), |
|
390 u'time': u'{:.0f}'.format(ctx.date()[0]), |
390 }, |
391 }, |
391 }), |
392 }), |
392 } |
393 } |
393 callconduit(ctx.repo(), b'differential.setdiffproperty', params) |
394 callconduit(ctx.repo(), b'differential.setdiffproperty', params) |
394 |
395 |