[PATCH stable json v2] log: fix json-formatted output when file copies are listed (issue4523)

Augie Fackler raf at durin42.com
Tue Feb 3 17:47:55 UTC 2015


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1422905207 18000
#      Mon Feb 02 14:26:47 2015 -0500
# Branch stable
# Node ID aa0b8231a39ef798d964e7534efb0c8d46b29960
# Parent  3667bc21b8773715d9472a3b4e034b77e62c6451
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
 


More information about the Mercurial-devel mailing list