[PATCH STABLE] cmdutil.jsonchangeset: properly compute added and removed files

Sean Farley sean.michael.farley at gmail.com
Tue Jan 6 01:01:29 CST 2015


Gregory Szorc writes:

> On 1/5/15 10:38 PM, Sean Farley wrote:
>>
>> Gregory Szorc writes:
>>
>>> # HG changeset patch
>>> # User Gregory Szorc <gregory.szorc at gmail.com>
>>> # Date 1420525135 28800
>>> #      Mon Jan 05 22:18:55 2015 -0800
>>> # Branch stable
>>> # Node ID d7b2b6b823ecdbdfc42f164a40dd07175343e581
>>> # Parent  aafeaba22826f27cb976e8f0b5ae028e86fd607e
>>> cmdutil.jsonchangeset: properly compute added and removed files
>>>
>>> jsonchangeset._show() was computing the reverse status of the current
>>> changeset. As a result, added files were showing up as removed and
>>> removed files were showing up as adds.
>>>
>>> There were existing tests for this code and they were flat out wrong.
>>>
>>> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
>>> --- a/mercurial/cmdutil.py
>>> +++ b/mercurial/cmdutil.py
>>> @@ -1071,9 +1071,9 @@ class jsonchangeset(changeset_printer):
>>>               self.ui.write(',\n  "extra": {%s}' %
>>>                             ", ".join('"%s": "%s"' % (j(k), j(v))
>>>                                       for k, v in ctx.extra().items()))
>>>
>>> -            files = ctx.status(ctx.p1())
>>> +            files = self.repo.status(ctx.p1().node(), ctx.node())
>>
>> Calling repo.status is the old way which I worked hard to remove :-) You
>> should just switch the order:
>>
>> ctx.p1().status(ctx)
>>
>
> Sorry about that. In my defense, I did copy the pattern from elsewhere. 
> Maybe that's because I was looking at stable when I made the patch?

No worries :-)

> Anyway, I reckon this can be fixed in flight?

Sure, but it's not my decision to make.


More information about the Mercurial-devel mailing list