[PATCH] revset: add 'only' revset

Matt Mackall mpm at selenic.com
Fri Feb 28 17:27:06 CST 2014


On Fri, 2014-02-28 at 12:29 -0500, Augie Fackler wrote:
> On Wed, Feb 26, 2014 at 11:35:14AM -0800, Durham Goode wrote:
> > # HG changeset patch
> > # User Durham Goode <durham at fb.com>
> > # Date 1384621028 28800
> > #      Sat Nov 16 08:57:08 2013 -0800
> > # Node ID 9bcbd10a93137b4dbc83bebd41fb4f00143a7615
> > # Parent  0ad353831461516132f57ccda8e8e0515213ec60
> > revset: add 'only' revset
> 
> Not crazy about the name, but seems reasonable.
> 
> I had to think about this for a /long/ time to figure out that it's
> not ancestors(<set>). Can you figure out some clearer descriptions of
> this operator?
> 
> >
> > Adds a only() revset that has two forms:
> >
> > only(<set>) is equivalent to "::<set> - ::(heads() - heads(<set>::))"
> >
> > only(<include>,<exclude>) is equivalent to "::<include> - ::<exclude>"
> >
> > On a large repo, this implementation can process/traverse 50,000 revs in 0.7
> > seconds, versus 4.2 seconds using "::<include> - ::<exclude>".
> 
> Hm. I wonder if we could do something to make - smarter so that it
> could auto-optimize that case? Probably too ambitious.

Nah, now that only exists, rewriting "::x - ::y" to only(x, y) in the
optimizer is pretty easy. But actually, I think we already did this?

changeset:   20635:2efd608473fb
user:        Siddharth Agarwal <sid0 at fb.com>
date:        Thu Feb 13 14:04:47 2014 -0800
files:       mercurial/revset.py tests/test-revset.t
description:
revset: optimize missing ancestor expressions

A missing ancestor expression is any expression of the form (::x - ::y) or
equivalent. Such expressions are remarkably common, and so far have involved
multiple walks down the DAG, followed by a set difference operation.

With this patch, such expressions will be transformed into uses of the fast
algorithm at ancestor.missingancestor.

For a repository with over 600,000 revisions, perfrevset for '::tip - ::-10000'
returns:

Before: ! wall 3.999575 comb 4.000000 user 3.910000 sys 0.090000 (best of 3)
After:  ! wall 0.132423 comb 0.130000 user 0.130000 sys 0.000000 (best of 75)



-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list