diff tests/test-revset.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 beb667c9880f
line wrap: on
line diff
--- a/tests/test-revset.t	Wed Dec 27 13:53:21 2017 -0600
+++ b/tests/test-revset.t	Wed Dec 27 11:08:32 2017 -0700
@@ -1484,7 +1484,7 @@
   $ hg debugrevspec -s 'last(0::)'
   * set:
   <baseset slice=0:1
-    <generatorset->>
+    <generatorsetasc->>
   9
   $ hg identify -r '0::' --num
   9