[PATCH 1 of 5 EVOLVE] fold: clarify message for empty revision set and abort instead (BC)
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Mon Jun 30 13:50:24 CDT 2014
On 06/30/2014 08:28 PM, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh at octave.org>
> # Date 1404138435 14400
> # Mon Jun 30 10:27:15 2014 -0400
> # Node ID 5b362328531a3e47a18b21cb80659e81c37edf3a
> # Parent 404a000bb38b0139ad93feb4327a5f2d1ea8c0f8
> fold: clarify message for empty revision set and abort instead (BC)
>
> I find it clearer that there are no revisions to fold because none
> were specified. Otherwise it seems ambiguous: maybe there are no
> revisions to fold because it's impossible to fold whatever was given?
> In analogy of other commands that are given no revisions (e.g. strip,
> graft), this is also now an abort instead of a mere error message,
> which is a BC.
>
> This patch also uses i18n and thus removes the usage of "_" as a
> temporary variable.
"also" → split
This is a very good example of a small change that is very easy to put
in his own patch. This simplify the diff of more complicated patches and
ease bisection.
>
> diff --git a/hgext/evolve.py b/hgext/evolve.py
> --- a/hgext/evolve.py
> +++ b/hgext/evolve.py
> @@ -2098,8 +2098,7 @@ def fold(ui, repo, *revs, **opts):
> else:
> revs = ()
> if not revs:
> - ui.write_err('no revision to fold\n')
> - return 1
> + raise util.Abort(_('no revisions specified'))
> roots = repo.revs('roots(%ld)', revs)
> if len(roots) > 1:
> raise util.Abort("set has multiple roots")
> @@ -2129,9 +2128,9 @@ def fold(ui, repo, *revs, **opts):
> commitopts['message'] = "\n".join(msgs)
> commitopts['edit'] = True
>
> - newid, _ = rewrite(repo, root, allctx, head,
> - [root.p1().node(), root.p2().node()],
> - commitopts=commitopts)
> + newid, unusedvariable = rewrite(repo, root, allctx, head,
> + [root.p1().node(), root.p2().node()],
> + commitopts=commitopts)
> phases.retractboundary(repo, targetphase, [newid])
> createmarkers(repo, [(ctx, (repo[newid],))
> for ctx in allctx])
> diff --git a/tests/test-evolve.t b/tests/test-evolve.t
> --- a/tests/test-evolve.t
> +++ b/tests/test-evolve.t
> @@ -614,8 +614,8 @@ Test fold
>
> $ rm *.orig
> $ hg fold
> - no revision to fold
> - [1]
> + abort: no revisions specified
> + [255]
> $ hg fold 6 --rev 10
> abort: cannot specify both --rev and a target revision
> [255]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list