# HG changeset patch # User Yuya Nishihara # Date 1426331795 -32400 # Node ID e74f819e9160f8529c1238fa5b9c9860f119d68b # Parent 201caa10536b533759b21eddbf540c638227e68d 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. diff -r 201caa10536b -r e74f819e9160 mercurial/cmdutil.py --- 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)) diff -r 201caa10536b -r e74f819e9160 tests/test-log.t --- a/tests/test-log.t Sat Mar 14 20:15:40 2015 +0900 +++ b/tests/test-log.t Sat Mar 14 20:16:35 2015 +0900 @@ -1666,6 +1666,27 @@ } ] + $ hg log -r 'wdir()' -Tjson --debug + [ + { + "rev": null, + "node": null, + "branch": "default", + "phase": "draft", + "user": "test", + "date": [*, 0], (glob) + "desc": "", + "bookmarks": [], + "tags": ["tip"], + "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"], + "manifest": null, + "extra": {"branch": "default"}, + "modified": [], + "added": [], + "removed": [] + } + ] + Check that adding an arbitrary name shows up in log automatically $ cat > ../names.py <