[PATCH 1 of 2] commit: return 1 for interactive commit with no changes (issue5397)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Oct 13 09:22:28 EDT 2016



On 10/13/2016 02:32 PM, Philippe Pepiot wrote:
> # HG changeset patch
> # User Philippe Pepiot <philippe.pepiot at logilab.fr>
> # Date 1476266974 -7200
> #      Wed Oct 12 12:09:34 2016 +0200
> # Node ID fa75185b8901e58d4b1117985e9f3f20e89c4e01
> # Parent  b85fa6bf298be07804a74d8fdec0d19fdbc6d740
> # EXP-Topic record-return-code
> commit: return 1 for interactive commit with no changes (issue5397)
>
> For consistency with non interactive commit
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -1648,9 +1648,9 @@ def commit(ui, repo, *pats, **opts):
>  def _docommit(ui, repo, *pats, **opts):
>      if opts.get('interactive'):
>          opts.pop('interactive')
> -        cmdutil.dorecord(ui, repo, commit, None, False,
> -                        cmdutil.recordfilter, *pats, **opts)
> -        return
> +        ret = cmdutil.dorecord(ui, repo, commit, None, False,
> +                               cmdutil.recordfilter, *pats, **opts)
> +        return 1 if ret == 0 else ret

I'm confused about this return value. "if ret == 0" we return 1; if 
return is not zero, we return the value. Do we never return 0 or am I 
missing something ?

Cheers,

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list