diff tests/test-revset2.t @ 35501:12a46ad67a3c

smartset: split generatorset classes to avoid cycle I uncovered a cycle manifesting in a memory leak by running `hgperfrevset '::tip'`. The cycle was due to generatorset.__init__ assigning a bound method to self.__contains__. Internet sleuthing revealed that assigning a bound method to an instance attribute always creates a cycle. This commit creates two new variants of generatorset for the special cases of ascending and descending generators. The special implementations of __contains__ have been extracted to these classes where they are defined as __contains__. generatorset now implements __new__ and changes the spawned type to one of the new classes if needed. Differential Revision: https://phab.mercurial-scm.org/D1780
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 27 Dec 2017 11:08:32 -0700
parents 1644623ab096
children 1a09dad8b85a
line wrap: on
line diff
--- a/tests/test-revset2.t	Wed Dec 27 13:53:21 2017 -0600
+++ b/tests/test-revset2.t	Wed Dec 27 11:08:32 2017 -0700
@@ -152,7 +152,7 @@
   * set:
   <addset
     <baseset- [1, 3, 5]>,
-    <generatorset+>>
+    <generatorsetdesc+>>
   5
   3
   1
@@ -174,7 +174,7 @@
             (symbol '5'))))))
   * set:
   <addset+
-    <generatorset+>,
+    <generatorsetdesc+>,
     <baseset- [1, 3, 5]>>
   0
   1
@@ -927,7 +927,7 @@
       (symbol 'merge')
       None))
   * set:
-  <generatorset+>
+  <generatorsetasc+>
   6
   7