[PATCH v2] rebase: add potential divergent commit hashes to error message (issue5086)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Feb 22 18:41:18 EST 2016



On 02/23/2016 12:02 AM, Augie Fackler wrote:
> 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.

Yes, long hash is un-necessary/unusual here. We should stick to a short 
version,

Rebase complain because you are about to rewrite (here rebase), an 
absolete changeset that already have a sucessors. Creating a second 
successor will create divergence.

There is a couple thing we could improve here:

a) finish Laurent work on skipping changeset already in destination, 
that should remove most of it.

b) suggest/tell/explain-how the user could exclude that changesets from 
its rebase.

c) points at that already existing successors,

d) improvement d.

that said, this message is already some improvement compared to the new 
one. I've pushed to the clowncopter a version using short hash.

Cheers,

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list