[PATCH 3 of 3] revset: drop factory that promotes spanset to fullreposet

Yuya Nishihara yuya at tcha.org
Fri Jun 5 09:01:16 CDT 2015


On Wed, 03 Jun 2015 09:05:10 -0700, Pierre-Yves David wrote:
> On 06/03/2015 07:37 AM, Yuya Nishihara wrote:
> > On Sun, 17 May 2015 20:12:50 -0700, Pierre-Yves David wrote:
> >> So, there does not seems to be an obvious consensus and the question
> >> seems to be complicated. I think we need to take a global look at this
> >> issue to ensure we have something consistent in 3.5. This is especially
> >> important if we want to push the 'wdir()' forward.
> >>
> >> I think we need to start a wiki page at this point. The wiki page would
> >> list:
> >>
> >> - a set of relevant example usecases. With possible behavior.
> >> - sorts -all- existing revset is a set of relevant categories taking in
> >> account how they are affected by null/wdir and if their implementation
> >> would need rework to support them.
> >
> > I've updated the wiki page to show the current status of null revision in
> > revset.
> >
> > https://mercurial.selenic.com/wiki/RevsetVirtualRevisionPlan
> >
> > It doesn't list the status of wdir(), but I believe wdir() will crash in most
> > cases because of None.
> 
> And I'm sure None is used as 'no value' in multiple case so this might
> be a pain to get it working (expecially in the extension world)

Yes. Because revset heavily depends on numeric revisions, None shouldn't appear
in set. My plan for the None issue is to map 'wdir()' to 'len(repo)'.

  wdir() -> len(repo)
  repo[len(repo)] -> wctx
  # canonical form is 'None'
  wctx.rev() -> None
  repo[None] -> wctx

A downside of this design is that we have to be careful of using ctx.rev().

  revs = repo.revs(...)
  r = revs.first()
  r in revs  # ok
  ctx = repo[r]
  ctx.rev() in revs  # fails if ctx is a workingctx


More information about the Mercurial-devel mailing list