[PATCH 2 of 3] changeset: adjust json output to use new/old (BC)
timeless
timeless at mozdev.org
Wed Apr 13 13:14:35 EDT 2016
# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1460548060 0
# Wed Apr 13 11:47:40 2016 +0000
# Node ID 4161598737bc141a062d8fa0d2c90da823e5b6c9
# Parent 57f09cb9c2e69b0e8ef89cd21758722ba7e07ff6
changeset: adjust json output to use new/old (BC)
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
@@ -1449,8 +1449,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"}}]
}
]
More information about the Mercurial-devel
mailing list