[PATCH V2] rebase: better error message when rebased changes are all in destination

Augie Fackler raf at durin42.com
Thu Dec 31 10:24:15 CST 2015


On Tue, Dec 29, 2015 at 03:32:42PM -0800, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1451431932 28800
> #      Tue Dec 29 15:32:12 2015 -0800
> # Node ID 5732bc59c77fb50e1658aa2223f9932e849e662f
> # Parent  23541bdd1610c08af247f9c8719045cf247ce541
> rebase: better error message when rebased changes are all in destination

queued, thanks

>
> Before this patch, when rebasing a set of obsolete revisions that were plain
> pruned or already present in the destination, we were displaying:
>
> abort: no matching revisions
>
> This was not very helpful to understand what was going on, instead we replace
> the error message by:
>
> abort: all requested changesets have equivalents or were marked as obsolete
> (to force the rebase, set the config experimental.rebaseskipobsolete to False)
>
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -348,6 +348,13 @@ def rebase(ui, repo, **opts):
>                  # - split changesets are not rebased if at least one of the
>                  # changeset resulting from the split is an ancestor of dest
>                  rebaseset = rebasesetrevs - set(obsoletenotrebased)
> +                if rebasesetrevs and not rebaseset:
> +                    msg = _('all requested changesets have equivalents '
> +                            'or were marked as obsolete')
> +                    hint = _('to force the rebase, set the config '
> +                             'experimental.rebaseskipobsolete to False')
> +                    raise error.Abort(msg, hint=hint)
> +
>              result = buildstate(repo, dest, rebaseset, collapsef,
>                                  obsoletenotrebased)
>
> diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
> --- a/tests/test-rebase-obsolete.t
> +++ b/tests/test-rebase-obsolete.t
> @@ -685,3 +685,30 @@ Even when the chain include missing node
>    rebasing 4:ff2c4d47b71d "C"
>    note: not rebasing 7:360bbaa7d3ce "O", it has no successor
>    rebasing 8:8d47583e023f "P" (tip)
> +
> +If all the changeset to be rebased are obsolete and present in the destination, we
> +should display a friendly error message
> +
> +  $ hg log -G
> +  @  10:121d9e3bc4c6 P
> +  |
> +  o  9:4be60e099a77 C
> +  |
> +  o  6:9c48361117de D
> +  |
> +  o  2:261e70097290 B2
> +  |
> +  o  0:4a2df7238c3b A
> +
> +
> +  $ hg up 9
> +  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
> +  $ echo "non-relevant change" > nonrelevant
> +  $ hg add nonrelevant
> +  $ hg commit -m nonrelevant
> +  created new head
> +  $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=all
> +  $ hg rebase -r . -d 10
> +  abort: all requested changesets have equivalents or were marked as obsolete
> +  (to force the rebase, set the config experimental.rebaseskipobsolete to False)
> +  [255]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list