Mercurial > hg
diff 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 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat Mar 14 20:15:40 2015 +0900 +++ b/mercurial/cmdutil.py Sat Mar 14 20:16:35 2015 +0900 @@ -1296,7 +1296,11 @@ ", ".join('"%s"' % c.hex() for c in ctx.parents())) if self.ui.debugflag: - self.ui.write(',\n "manifest": "%s"' % hex(ctx.manifestnode())) + if rev is None: + jmanifestnode = 'null' + else: + jmanifestnode = '"%s"' % hex(ctx.manifestnode()) + self.ui.write(',\n "manifest": %s' % jmanifestnode) self.ui.write(',\n "extra": {%s}' % ", ".join('"%s": "%s"' % (j(k), j(v))