[PATCH 2 of 2] notify: support revset selection for subscriptions

Matt Mackall mpm at selenic.com
Wed Jun 6 23:47:49 CDT 2012


On Wed, 2012-06-06 at 22:04 -0500, David Champion wrote:
> * On 06 Jun 2012, Matt Mackall wrote: 
> > On Tue, 2012-05-29 at 07:58 -0500, David Champion wrote:
> > > # HG changeset patch
> > > # User David Champion <dgc at uchicago.edu>
> > > # Date 1338296186 18000
> > > # Node ID b63788f02e53f1ecf00281adc71f19656e11dcd1
> > > # Parent  222934f53810943a6e7eb74ebd756ea8cafa810e
> > > notify: support revset selection for subscriptions
> > 
> > This really wants to use repo.revs():
> > 
> > http://www.selenic.com/hg/file/4a02cf4fbb2e/mercurial/localrepo.py#l245
> > 
> > The syntax of the expression is described here:
> > 
> > http://www.selenic.com/hg/file/4a02cf4fbb2e/mercurial/revset.py#l1408
> > 
> > It can probably be as simple as:
> > 
> > revs = repo.revs("%r and %ld", filterspec, listofnewrevs)
> 
> I'm new to revsets, and didn't know repo.revs(), but I thought that
> limiting the scope of search in python rather than in revset grammer
> would be faster.  I'm guessing that it probably does, but not enough to
> matter in a single-pass setup utility, so it's better to use a familiar
> idiom?

That.. and revsets have a fairly effective query optimizer.

> > > A repo pattern for any notify configuration contains a glob matching the
> > > path to the repo. Additionally, it may now contain a revset spec, separated
> > > from the glob by '//'.
> > 
> > That separator is a bit unprecedented around here. There is however some
> > precedent for '#'.
> 
> I'm fine with that, but I picked '//' because (in POSIX pathspace
> anyway) it's unlikely to be otherwise meaningful: it's equivalent to
> '/', and it doesn't use up a character that could appear in filenames.
> Just making the note -- I'll switch to '#' if that's still your
> preference.

Well, it is actually slightly magical in POSIX, in that any sequence of
slashes except for two leading slashes is definitionally the same as
one. Not really an issue, but you're not really escaping the POSIX
pathspace.

Mercurial already reserves a URL-style '#' for specifying a
changeset/branch/tag to push or pull, which is pretty analogous to
what's happening here.

> > > Example:
> > >   [reposubs]
> > >   */widgets//branch(release)  qa-team at example.com
> > 
> > That syntax looks weird.. missing '='?
> 
> Oops, thanks.  I'll update and resend patch 2.
> 


-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list