[PATCH evolve-ext] fold: add argument to handle ambiguous case
Durham Goode
durham at fb.com
Wed Jun 3 03:35:21 UTC 2015
On 6/2/15 8:32 PM, Durham Goode wrote:
>
>
> On 5/31/15 1:03 PM, Pierre-Yves David wrote:
>>
>>
>> On 05/30/2015 02:28 AM, Gilles Moris wrote:
>>> Le 30/05/2015 03:29, Pierre-Yves David a écrit :
>>>
>>> I am not convinced that it needs 2 flags, or even 1.
>>>
>>> Forgetting about the current UI, we could expect that providing a
>>> single
>>> commit would fold up to the working dir. If a complex revset is
>>> provided, I guess the power user could do "first(revset)". If we really
>>> want a flag for safety, we could use -f/--from: "hg fold -f 7".
>>> Then if a revset yields multiple commits, I would expect the --exact
>>> behavior.
>>
>> I'll insist on the fact we cannot rely on 'number of commit' because
>> revset is not "predicable enough".
>>
>> Basic user will start provided simple revsets with "non-predicable"
>> result, and you should not expect them to be smart enough to add
>> "first" like element to it until it suddenly break for unclear (to
>> them reason) and stop trusting the tool.
>>
>> Moreover, You have way to force the 'multiple -> one' way. But you
>> have no way to go the other way. Lets look at this command command:
>>
>> - hg fold --exact 'draft() and ::mybook'
>>
>> Current behavior (with --exact)
>>
>> revs | result
>> -------------
>> 0-1 | abort 'nothing to fold here'
>> 2+ | fold all revs together
>>
>> This is a safe sensible and predictable behavior.
>>
>> With 'auto detect revset size proposal'
>>
>>
>> revs | result
>> -------------
>> 0 | abort 'no rev'
>> 0-1 | fold 'revs::.'
>> 2+ | fold all revs together
>>
>> This is unpredictable behavior that will blow in people face.
>>
>> So, think of the children, do not relying on the size of the revset
>> result.
>>
> If a user specifies a single commit (via revset, or node, or
> whatever), can we error out and say "you only specified one commit.
> did you mean: hg fold X::." ? That keeps the syntax precise (fold
> exactly what I say, don't compute any closures), and teaches the user
> about revsets.
Heck, if X is the immediate parent, you could even suggest "hg fold 'X +
.'" so it's extremely obvious what the correct syntax is (no
understanding of :: necessary)
More information about the Mercurial-devel
mailing list