# HG changeset patch # User Augie Fackler # Date 2015-02-02 19:26:47 # Node ID 942a5a34b2d0611ab284380fbe45b9bb1897af98 # Parent 873eb5db89c86583d95c55f8de2904d09ba77ec0 log: fix json-formatted output when file copies are listed (issue4523) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1091,8 +1091,8 @@ class jsonchangeset(changeset_printer): if copies: self.ui.write(',\n "copies": {%s}' % - ", ".join('"%s": %s' % (j(k), j(copies[k])) - for k in copies)) + ", ".join('"%s": "%s"' % (j(k), j(v)) + for k, v in copies)) matchfn = self.matchfn if matchfn: diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -494,7 +494,23 @@ log copies with hardcoded style and with e - + $ hg log -vC -r4 -Tjson + [ + { + "rev": 4, + "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3", + "branch": "default", + "phase": "draft", + "user": "test", + "date": [5, 0], + "desc": "e", + "bookmarks": [], + "tags": ["tip"], + "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"], + "files": ["dir/b", "e"], + "copies": {"e": "dir/b"} + } + ] log copies, non-linear manifest