[PATCH 4 of 4] revset: introduce a 'foo#stack[n]' subscript relation to access stack revisions
pierre-yves.david at ens-lyon.org
Tue Sep 24 20:48:09 EDT 2019
On 9/25/19 1:25 AM, Yuya Nishihara wrote:
> On Tue, 24 Sep 2019 21:16:53 +0200, Pierre-Yves David wrote:
>> On 9/23/19 2:58 PM, Yuya Nishihara wrote:
>>> On Mon, 23 Sep 2019 10:39:52 +0700, Anton Shestakov wrote:
>>>> # HG changeset patch
>>>> # User Anton Shestakov <av6 at dwimlabs.net>
>>>> # Date 1569139969 -25200
>>>> # Sun Sep 22 15:12:49 2019 +0700
>>>> # Node ID ab8f097abacb8ce0f9cea2bce0924bb2fd3261a2
>>>> # Parent 07af98a1e730c1ffa6911c9ab2cdcc06d4ffe52d
>>>> # EXP-Topic stack-object
>>>> revset: introduce a 'foo#stack[n]' subscript relation to access stack revisions
>>>> The idea behind making n = 0 cases special is that stack base should be
>>>> accessible, but only when users ask for it explicitly.
>>>> +def stackrel(repo, subset, x, rel, z, order):
>>>> + a, b = getintrange(z,
>>>> + _('relation subscript must be an integer or a range'),
>>>> + _('relation subscript bounds must be integers'),
>>>> + deffirst=None,
>>>> + deflast=None)
>>>> + s = getset(repo, fullreposet(repo), x)
>>>> + if not s:
>>>> + return baseset()
>>>> + def getrange(st, a, b):
>>>> + start = 1 if a is None else a
>>>> + end = len(st.indexedrevs) if b is None else b + 1
>>> I feel it's weird that stack[:] doesn't include stack.
>>  is the "root" of the stack, but not part of it. It is handy to have
>> it around when one want to insert and initial commit or test thing
>> without any of the stack changes, however it not part of the stack.
>> For example if you want to update all changesets in the stack you could
>> do `hg metaedit --rev '.#stack[:]' --user foobar`. You don't want to
>> select s0 it might even be a public changesets.
> I understand that. My point is it may be confusing if foo[:] includes #foo,
> but #bar[:] doesn't.
I suspect we already have a "every namespace behave differently
situation". The "generation" namespace is not table indexing ".#g" is
".", and ".#g[X]' might return more than on revision.
Alternatively, maybe stacks needs a different syntax ?
More information about the Mercurial-devel