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

Gregory Szorc gregory.szorc at gmail.com
Mon Feb 2 14:24:59 CST 2015



> On Feb 2, 2015, at 11:44, Augie Fackler <raf at durin42.com> wrote:
> 
> # 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 ec704a2226e9ff7492797fd4fa0977bd5f34d092
> # 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}

Why isn't "dir/b" quoted?

> +   }
> +  ]
> 
> log copies, non-linear manifest
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list