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

login
register
mail settings
Submitter Augie Fackler
Date Feb. 3, 2015, 5:47 p.m.
Message ID <aa0b8231a39ef798d964.1422985675@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/7636/
State Accepted
Commit 942a5a34b2d0611ab284380fbe45b9bb1897af98
Headers show

Comments

Augie Fackler - Feb. 3, 2015, 5:47 p.m.
# HG changeset patch
# User Augie Fackler <augie@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)
Matt Mackall - Feb. 4, 2015, 12:15 a.m.
On Tue, 2015-02-03 at 12:47 -0500, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@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)

Queued for stable, thanks.

Patch

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