changeset 50772:1680ef94ad2b stable

repoview: fix the filter created by `extrafilter` The `name` variable was updated in each interaction of the loop, making all new filters inheriting from the same base (the last one iterated), leading to terrible terrible misbehavior.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 12 Jul 2023 12:47:08 +0200
parents d24573181003
children ac8b7bd915a0
files mercurial/repoview.py tests/test-server-view.t
diffstat 2 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/repoview.py	Wed Jul 12 12:46:58 2023 +0200
+++ b/mercurial/repoview.py	Wed Jul 12 12:47:08 2023 +0200
@@ -209,16 +209,18 @@
     subsettable = repoviewutil.subsettable
 
     if combine(b'base') not in filtertable:
-        for name in _basefiltername:
+        for base_name in _basefiltername:
 
-            def extrafilteredrevs(repo, *args, **kwargs):
+            def extrafilteredrevs(repo, *args, name=base_name, **kwargs):
                 baserevs = filtertable[name](repo, *args, **kwargs)
                 extrarevs = frozenset(repo.revs(frevs))
                 return baserevs | extrarevs
 
-            filtertable[combine(name)] = extrafilteredrevs
-            if name in subsettable:
-                subsettable[combine(name)] = combine(subsettable[name])
+            filtertable[combine(base_name)] = extrafilteredrevs
+            if base_name in subsettable:
+                subsettable[combine(base_name)] = combine(
+                    subsettable[base_name]
+                )
     return fid
 
 
--- a/tests/test-server-view.t	Wed Jul 12 12:46:58 2023 +0200
+++ b/tests/test-server-view.t	Wed Jul 12 12:47:08 2023 +0200
@@ -108,11 +108,11 @@
   r3
   r4
   r5
-  r6 (missing-correct-output !)
-  r7 (missing-correct-output !)
-  r8 (missing-correct-output !)
-  r11 (missing-correct-output !)
-  r12 (missing-correct-output !)
+  r6
+  r7
+  r8
+  r11
+  r12
 
 cleanups