[PATCH 6 of 7] contrib/perf: perfparents handle filtered repos

Gregory Szorc gregory.szorc at gmail.com
Tue Nov 24 17:37:31 CST 2015


On Tue, Nov 24, 2015 at 2:36 PM, timeless <timeless at mozdev.org> wrote:

> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1448400980 0
> #      Tue Nov 24 21:36:20 2015 +0000
> # Node ID dd024f4eafead08b0d150eb2b9210d6d3087fd65
> # Parent  3cf447f1d3a7d77969331a93c8cd003b1dbcbaf7
> contrib/perf: perfparents handle filtered repos
>
> diff --git a/contrib/perf.py b/contrib/perf.py
> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -302,7 +302,10 @@
>      timer, fm = gettimer(ui, opts)
>      if len(repo.changelog) < 1000:
>          raise error.Abort("repo needs 1000 commits for this test")
> -    nl = [repo.changelog.node(i) for i in xrange(1000)]
> +    try:
> +        nl = [repo.changelog.node(i) for i in xrange(1000)]
> +    except error.FilteredIndexError:
> +        raise error.Abort("the first 1000 commits cannot be filtered")
>      def d():
>          for n in nl:
>              repo.changelog.parents(n)
>

You could also operate on repo.unfiltered() instead of repo, which is
filtered by default. revlogs aren't sparse, so repo[0..1000] are guaranteed
to exist in the unfiltered view.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20151124/fee30106/attachment.html>


More information about the Mercurial-devel mailing list