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

login
register
mail settings
Submitter timeless@mozdev.org
Date Nov. 24, 2015, 10:36 p.m.
Message ID <dd024f4eafead08b0d15.1448404589@waste.org>
Download mbox | patch
Permalink /patch/11625/
State Accepted
Headers show

Comments

timeless@mozdev.org - Nov. 24, 2015, 10:36 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1448400980 0
#      Tue Nov 24 21:36:20 2015 +0000
# Node ID dd024f4eafead08b0d150eb2b9210d6d3087fd65
# Parent  3cf447f1d3a7d77969331a93c8cd003b1dbcbaf7
contrib/perf: perfparents handle filtered repos
Gregory Szorc - Nov. 24, 2015, 11:37 p.m.
On Tue, Nov 24, 2015 at 2:36 PM, timeless <timeless@mozdev.org> wrote:

> # HG changeset patch
> # User timeless <timeless@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.
Augie Fackler - Nov. 24, 2015, 11:46 p.m.
On Tue, Nov 24, 2015 at 04:36:29PM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1448400980 0
> #      Tue Nov 24 21:36:20 2015 +0000
> # Node ID dd024f4eafead08b0d150eb2b9210d6d3087fd65
> # Parent  3cf447f1d3a7d77969331a93c8cd003b1dbcbaf7
> contrib/perf: perfparents handle filtered repos

Queued 1-6, looking at 7 now. Thanks!

>
> 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)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

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)