[PATCH 7 of 8 STABLE] revset: also inline spanset._contained in __len__
Durham Goode
durham at fb.com
Mon Apr 28 21:27:22 CDT 2014
On 4/28/14, 5:48 PM, "pierre-yves.david at ens-lyon.org"
<pierre-yves.david at ens-lyon.org> wrote:
># HG changeset patch
># User Pierre-Yves David <pierre-yves.david at fb.com>
># Date 1398474007 25200
># Fri Apr 25 18:00:07 2014 -0700
># Branch stable
># Node ID 00d62213d5785c5875d2251d3cde737b994ca1c6
># Parent 881523ca83343eb7e613cb254b46195b8a3261c0
>revset: also inline spanset._contained in __len__
>
>For consistency with what happen in `__contains__`, we inline the range
>test
>into `__len__` too.
>
>diff --git a/mercurial/revset.py b/mercurial/revset.py
>--- a/mercurial/revset.py
>+++ b/mercurial/revset.py
>@@ -2819,12 +2819,14 @@ class spanset(_orderedsetmixin):
> def __len__(self):
> if not self._hiddenrevs:
> return abs(self._end - self._start)
> else:
> count = 0
>+ start = self._start
>+ end = self._end
> for rev in self._hiddenrevs:
>- if self._contained(rev):
>+ if (end < rev <= start) or (start <= rev and rev < end):
Did you mean to leave the Œand¹ in there instead of collapsing it into a
single a <= b < c like the other patches?
> count += 1
> return abs(self._end - self._start) - count
>
> def __getitem__(self, x):
> # Basic implementation to be changed in future patches.
>_______________________________________________
>Mercurial-devel mailing list
>Mercurial-devel at selenic.com
>http://selenic.com/mailman/listinfo/mercurial-devel
>
More information about the Mercurial-devel
mailing list