From patchwork Fri Feb 26 18:12:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,3,v2] changeset: adjust json output to use new/old From: timeless@mozdev.org X-Patchwork-Id: 13425 Message-Id: <3e1dbbc6ece30c6207c2.1456510362@waste.org> To: mercurial-devel@mercurial-scm.org Date: Fri, 26 Feb 2016 12:12:42 -0600 # HG changeset patch # User timeless # Date 1456455801 0 # Fri Feb 26 03:03:21 2016 +0000 # Node ID 3e1dbbc6ece30c6207c21bb47b888b39e1052a02 # Parent d66dc235bd21ed08c5661fd62604d0c1bcfd0f8a changeset: adjust json output to use new/old The previous json structure was not friendly to strongly structured parsing. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1395,8 +1395,9 @@ ", ".join('"%s"' % j(f) for f in ctx.files())) if copies: - self.ui.write(',\n "copies": {%s}' % - ", ".join('"%s": "%s"' % (j(k), j(v)) + self.ui.write(',\n "copies": [%s]' % + ", ".join('{"new": {"path": "%s"}, ' + '"old": {"path": "%s"}}' % (j(k), j(v)) for k, v in copies)) matchfn = self.matchfn diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -524,7 +524,7 @@ "tags": ["tip"], "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"], "files": ["dir/b", "e"], - "copies": {"e": "dir/b"} + "copies": [{"new": {"path": "e"}, "old": {"path": "dir/b"}}] } ]