[PATCH] phases: return zero for no-op operations (issue4751)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Sep 25 16:58:12 CDT 2015



On 09/25/2015 10:21 AM, Augie Fackler wrote:
> On Fri, Sep 25, 2015 at 10:20:51AM -0400, Jordi Gutiérrez Hermoso wrote:
>> On Fri, 2015-09-18 at 09:49 +0200, Julien Cristau wrote:
>>> On Tue, Sep 15, 2015 at 13:52:42 -0400, Jordi Gutiérrez Hermoso wrote:
>>>
>>>> On Tue, 2015-09-15 at 14:05 +0200, Julien Cristau wrote:
>>>>> On Mon, Sep 14, 2015 at 19:26:26 -0400, Jordi Gutiérrez Hermoso wrote:
>>>>>
>>>>>> # HG changeset patch
>>>>>> # User Jordi Gutiérrez Hermoso <jordigh at octave.org>
>>>>>> # Date 1442273134 14400
>>>>>> #      Mon Sep 14 19:25:34 2015 -0400
>>>>>> # Node ID a247eb167de1ee9f447b7e0bbab0fc98babe3d7a
>>>>>> # Parent  6c962145f523e6e0ed1c94eb6764bf198a92917b
>>>>>> phases: return zero for no-op operations (issue4751)
>>>>>>
>>>>>> It is rather unhelpful to return 1 if there were no changes because
>>>>>> the request matches the current state of phases. So we just undo that.
>>>>>>
>>>>>> diff --git a/mercurial/commands.py b/mercurial/commands.py
>>>>>> --- a/mercurial/commands.py
>>>>>> +++ b/mercurial/commands.py
>>>>>> @@ -5032,8 +5032,7 @@ def phase(ui, repo, *revs, **opts):
>>>>>>
>>>>>>           public < draft < secret
>>>>>>
>>>>>> -    Returns 0 on success, 1 if no phases were changed or some could not
>>>>>> -    be changed.
>>>>>> +    Returns 0 on success, 1 if some phases could not be changed.
>>>>>>
>>>>>>       (For more information about the phases concept, see :hg:`help phases`.)
>>>>>>       """
>>>>>> @@ -5102,7 +5101,6 @@ def phase(ui, repo, *revs, **opts):
>>>>>>                   ui.note(msg)
>>>>>>           else:
>>>>>>               ui.warn(_('no phases changed\n'))
>>>>>> -            ret = 1
>>>>>
>>>>> This should probably be a note instead of warn?
>>>>
>>>> Hm, it should be a warning if there was a problem and a note
>>>> otherwise, right? If you feel strongly about it, I'll submit a V2.
>>>>
>>> I don't care all that much, I can live with the warning as long as the
>>> exit code gets fixed.  Thanks.
>>
>> If you don't care, I don't either. Can we queue this patch, then?
>
> I'm fine with this patch as stated. Pierre-yves, do you object, or
> shall I take it?

I do not have a strong opinion. I'm not usre it make sense to issue the 
warning at all if the change is a no-op but valid. (eg: moving from 
draft to draft)

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list