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

Jordi Gutiérrez Hermoso jordigh at octave.org
Tue Sep 15 12:52:42 CDT 2015


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.




More information about the Mercurial-devel mailing list