[PATCH 5 of 5 STABLE v2] revset: use _diffset in orderedlazyset.__sub__

Augie Fackler raf at durin42.com
Tue Sep 9 11:36:45 CDT 2014


On Mon, Sep 08, 2014 at 02:59:47PM -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1410200370 25200
> #      Mon Sep 08 11:19:30 2014 -0700
> # Node ID d2c3dd725cf9b64b564f13096102f61f6b0d06ba
> # Parent  b8226fb4800578b0d7b05f255f4c26140e458256
> revset: use _diffset in orderedlazyset.__sub__

This series looks good to me, but did you intend this for stable?

(I'll leave these flagged, and will consider dropping them into default
- this seems like it might be too invasive for stable.)

>
> On a clone of the Firefox repository, the following revsets from the
> revset benchmarks demonstrated a statistically significant change.
>
> revset #25: roots((0::) - (0::tip))
> wall 447.441994 comb 447.420000 user 447.240000 sys 0.180000 (best of 3)
> wall  14.762341 comb  14.770000 user  14.730000 sys 0.040000 (best of 3)
>
> This revset is very similar to one that runs as part of phase boundary
> advancement during clone/pull. This change thus makes clones of large
> repositories (like Firefox) much faster.
>
> Interestingly, a related revset (roots((tip~100::) - (tip~100::tip)))
> showed no statistically significant change.
>
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -2414,10 +2414,14 @@ class orderedlazyset(_orderedsetmixin, l
>          return orderedlazyset(self, x.__contains__,
>                  ascending=self._ascending)
>
>      def __sub__(self, x):
> -        return orderedlazyset(self, lambda r: r not in x,
> -                ascending=self._ascending)
> +        kwargs = {}
> +        if self.isascending() and x.isascending():
> +            kwargs['ascending'] = True
> +        if self.isdescending() and x.isdescending():
> +            kwargs['ascending'] = False
> +        return _diffset(self, x, **kwargs)
>
>      def __add__(self, x):
>          kwargs = {}
>          if self.isascending() and x.isascending():
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list