[PATCH v2] rebase: add potential divergent commit hashes to error message (issue5086)
Augie Fackler
raf at durin42.com
Mon Feb 22 18:02:52 EST 2016
On Wed, Feb 17, 2016 at 08:32:22PM +0000, Kostia Balytskyi wrote:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia at fb.com>
> # Date 1455741094 0
> # Wed Feb 17 20:31:34 2016 +0000
> # Node ID c91240e672a88d78abdcd571cfdcf2cba36504e6
> # Parent 95bf01b8754016200a99fd3538e78030b2028c60
> rebase: add potential divergent commit hashes to error message (issue5086)
>
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -305,10 +305,13 @@
> divergencebasecandidates = rebaseobsrevs - rebaseobsskipped
>
> if divergencebasecandidates and not divergenceok:
> - msg = _("this rebase will cause divergence")
> + divhashes = (repo.unfiltered()[r].hex()
> + for r in divergencebasecandidates)
> + msg = _("this rebase will cause "
> + "divergences with base(s): %s")
> h = _("to force the rebase please set "
> "rebase.allowdivergence=True")
> - raise error.Abort(msg, hint=h)
> + raise error.Abort(msg % (",".join(divhashes),), hint=h)
>
> # - plain prune (no successor) changesets are rebased
> # - split changesets are not rebased if at least one of the
> 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
> @@ -771,7 +771,7 @@
> phases: 8 draft
> unstable: 1 changesets
> $ hg rebase -s 10 -d 12
> - abort: this rebase will cause divergence
> + abort: this rebase will cause divergences with base(s): 121d9e3bc4c60bd1c9c007e7de31d6796b882a45
> (to force the rebase please set rebase.allowdivergence=True)
So, as a user, I'm actually not sure what I should /do/ in response to
this "will cause divergence" message other than force the rebase with
allowdivergence. Can we try and wordsmith this so that the /actual
problem/ is more clear? As it is we're just telling people a long hash
with no context.
> [255]
> $ hg log -G
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list