changeset 24013:942a5a34b2d0 stable

log: fix json-formatted output when file copies are listed (issue4523)
author Augie Fackler <augie@google.com>
date Mon, 02 Feb 2015 14:26:47 -0500
parents 873eb5db89c8
children f2a631c7387a d65ecb814fc0
files mercurial/cmdutil.py tests/test-log.t
diffstat 2 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Feb 03 21:56:29 2015 +0900
+++ b/mercurial/cmdutil.py	Mon Feb 02 14:26:47 2015 -0500
@@ -1091,8 +1091,8 @@
 
             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:
--- a/tests/test-log.t	Tue Feb 03 21:56:29 2015 +0900
+++ b/tests/test-log.t	Mon Feb 02 14:26:47 2015 -0500
@@ -494,7 +494,23 @@
   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