Submitter | timeless@mozdev.org |
---|---|
Date | Feb. 26, 2016, 5:12 p.m. |
Message ID | <f92bb104951e1f8d1aa3.1456506729@waste.org> |
Download | mbox | patch |
Permalink | /patch/13420/ |
State | Superseded |
Headers | show |
Comments
This series is very much RFC. This commit is probably more questionable than the other. The reason I'm making this change is because the "tool" I'm using to identify "keys" found "e" as a key (it's a child of the "copies" "key"), and that's annoying. I'm happy to not do this one, since there's some JS valuable to be able to do copies[file] -> get old name. On Fri, Feb 26, 2016 at 12:12 PM, timeless <timeless@mozdev.org> wrote: > # HG changeset patch > # User timeless <timeless@mozdev.org> > # Date 1456455801 0 > # Fri Feb 26 03:03:21 2016 +0000 > # Node ID f92bb104951e1f8d1aa3acc9cfc9f4cdbe713cfc > # Parent 7e94be4f7b542404823ae92ce3c6518bdc7d7257 > changeset: adjust json output to use new/old > > 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 > @@ -1395,8 +1395,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"}}] > } > ] > > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1395,8 +1395,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"}}] } ]