RFC: Phase UI (revset, phase command and others)

Benoit Boissinot bboissin at gmail.com
Tue Dec 27 23:45:04 UTC 2011


On Wed, Dec 28, 2011 at 12:23 AM, Pierre-Yves David
<pierre-yves.david at ens-lyon.org> wrote:
> On 27 déc. 2011, at 23:22, Gilles Moris wrote:
>> On Tuesday 27 December 2011 12:11:12 am Pierre-Yves David wrote:
>>> revset
>>> -------
>>>
>>> revset to select changeset according to their phase will be implemented.
>>>
>>> The naive solution is:
>>>
>>>   public()     match changeset in public phase.
>>>   draft()      match changeset in draft phase.
>>>   secret()     match changeset in secret phase.
>>>
>>> But in practice we want to be able to do more complicated queries:
>>>
>>>   * "Match all changeset at least draft" --> (draft() + secret())
>>>   * "Match all changeset at most draft" --> (draft() + public())
>>>
>>> There are multiple options to achieve this.
>>>
>>> Solution A: add more revset symbols
>>> ```````````````````````````````````````````````````
>>>
>>> Adding "exchanged()" and "mutable()" should do it.
>>>
>>> pro:
>>>  * simple to use
>>> con:
>>>  * multiplies symbols
>>>  * Does not scale well if we add phases
>>>
>>> Solution B: add argument to revset
>>> ``````````````````````````````````````````````````
>>>
>>> We add an "operator" argument to revset to control how it should be
>>> interpreted:
>>>
>>>   Match any changeset in phase draft or lower --> "draft('<=')"
>>>
>>> Possible values are '<', '<=', '='(default), '>=', '>'.
>>>
>>> pro:
>>>   * keep simple usage simple
>>>   * cover most things people will want to express (except phase between X
>>> and Y) cons:
>>>   * complicated usecase are a bit more complicated
>>>
>>>
>>> Solution C: Use a single symbol
>>> ``````````````````````````````````````````````````
>>>
>>> We can use a single "phases" revset taking a "phase-set" in argument:
>>>
>>>   match changesets in draft phase --> phase('draft)
>>>   match changesets in draft phase or lower --> phase('<=draft)
>>>   match changeset between public and secret phase -->
>>> phase('public::draft')
>>>
>>> pro:
>>>   * Add less symbol
>>>   * everything is done using the same symbol
>>>   * complex case are simpler to express
>>>   * cover any complicated case people might want
>>> cons:
>>>   * Make simple case more verbose
>>>
>>
>> Slightly prefer solution C as it is explicit.
>> In particular "phase('public::draft')" because it is consistent with revsets.
>> Anyway, revsets already have some aliases like author/user, so a mix of
>> solution A and C shall be possible.
>
> Benoit Boissinot expressed such option in private too. I quite like it.
>

Indeed I prefer C, with aliases for A.

Cheers,

Benoit



More information about the Mercurial-devel mailing list