Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 24603:e74f819e9160
jsonchangeset: set manifest node to "null" for workingctx
Unlike changeset_printer, it does not hide the manifest field because JSON
output will be parsed by machine where explicit "null" will be more useful
than nothing.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 14 Mar 2015 20:16:35 +0900 |
parents | 201caa10536b |
children | 21e1ece30f8c |
comparison
equal
deleted
inserted
replaced
24602:201caa10536b | 24603:e74f819e9160 |
---|---|
1294 ", ".join('"%s"' % j(t) for t in ctx.tags())) | 1294 ", ".join('"%s"' % j(t) for t in ctx.tags())) |
1295 self.ui.write(',\n "parents": [%s]' % | 1295 self.ui.write(',\n "parents": [%s]' % |
1296 ", ".join('"%s"' % c.hex() for c in ctx.parents())) | 1296 ", ".join('"%s"' % c.hex() for c in ctx.parents())) |
1297 | 1297 |
1298 if self.ui.debugflag: | 1298 if self.ui.debugflag: |
1299 self.ui.write(',\n "manifest": "%s"' % hex(ctx.manifestnode())) | 1299 if rev is None: |
1300 jmanifestnode = 'null' | |
1301 else: | |
1302 jmanifestnode = '"%s"' % hex(ctx.manifestnode()) | |
1303 self.ui.write(',\n "manifest": %s' % jmanifestnode) | |
1300 | 1304 |
1301 self.ui.write(',\n "extra": {%s}' % | 1305 self.ui.write(',\n "extra": {%s}' % |
1302 ", ".join('"%s": "%s"' % (j(k), j(v)) | 1306 ", ".join('"%s": "%s"' % (j(k), j(v)) |
1303 for k, v in ctx.extra().items())) | 1307 for k, v in ctx.extra().items())) |
1304 | 1308 |