Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG8fd19a7b4ed6: py3: only pass unicode to json.dumps in writediffproperties
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
return diff | return diff | ||||
def writediffproperties(ctx, diff): | def writediffproperties(ctx, diff): | ||||
"""write metadata to diff so patches could be applied losslessly""" | """write metadata to diff so patches could be applied losslessly""" | ||||
params = { | params = { | ||||
b'diff_id': diff[b'id'], | b'diff_id': diff[b'id'], | ||||
b'name': b'hg:meta', | b'name': b'hg:meta', | ||||
b'data': json.dumps({ | b'data': json.dumps({ | ||||
b'user': ctx.user(), | u'user': encoding.unifromlocal(ctx.user()), | ||||
b'date': b'%d %d' % ctx.date(), | u'date': u'{:.0f} {}'.format(*ctx.date()), | ||||
b'node': ctx.hex(), | u'node': encoding.unifromlocal(ctx.hex()), | ||||
b'parent': ctx.p1().hex(), | u'parent': encoding.unifromlocal(ctx.p1().hex()), | ||||
}), | }), | ||||
} | } | ||||
callconduit(ctx.repo(), b'differential.setdiffproperty', params) | callconduit(ctx.repo(), b'differential.setdiffproperty', params) | ||||
params = { | params = { | ||||
b'diff_id': diff[b'id'], | b'diff_id': diff[b'id'], | ||||
b'name': b'local:commits', | b'name': b'local:commits', | ||||
b'data': json.dumps({ | b'data': json.dumps({ | ||||
ctx.hex(): { | encoding.unifromlocal(ctx.hex()): { | ||||
b'author': stringutil.person(ctx.user()), | u'author': encoding.unifromlocal(stringutil.person(ctx.user())), | ||||
b'authorEmail': stringutil.email(ctx.user()), | u'authorEmail': encoding.unifromlocal(stringutil.email(ctx.user())), | ||||
b'time': ctx.date()[0], | u'time': u'{:.0f}'.format(ctx.date()[0]), | ||||
}, | }, | ||||
}), | }), | ||||
} | } | ||||
callconduit(ctx.repo(), b'differential.setdiffproperty', params) | callconduit(ctx.repo(), b'differential.setdiffproperty', params) | ||||
def createdifferentialrevision(ctx, revid=None, parentrevid=None, oldnode=None, | def createdifferentialrevision(ctx, revid=None, parentrevid=None, oldnode=None, | ||||
olddiff=None, actions=None): | olddiff=None, actions=None): | ||||
"""create or update a Differential Revision | """create or update a Differential Revision |