[PATCH 1 of 2] revset: add minus revset class

Durham Goode durham at fb.com
Wed Feb 10 19:25:04 EST 2016



On 2/10/16 4:23 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1455150122 28800
> #      Wed Feb 10 16:22:02 2016 -0800
> # Node ID edfc4fda0c1ca78186d9a779f0d4d0cfc6e1c03f
> # Parent  c791244507faabf86b1fd71746ec5b3d0364ed7d
> revset: add minus revset class
>
> Previously, revsets like 'X - Y' were translated to be 'X and not Y'. This can
> be expensive, since if Y is a single commit then 'not Y' becomes a huge set and
> sometimes the query optimizer doesn't account for it well.
>
> This patch adds a minusset smart revset class that knows how to handle the minus
> operator smartly. A future patch will change the optimizer to use this instead
> of changing '- Y' to be 'and not Y'.
>
> On a large repo this saves 2.2 seconds on rebase and histedit because "X:: - X"
> becomes almost instant. The future patch that actually uses the minus set will
> include more detailed performance numbers.
>
I forgot to mention it in the description, but this code is largely 
based on the existing addset class, with some optimizations removed that 
only apply to add cases.


More information about the Mercurial-devel mailing list