##// END OF EJS Templates
subsetmaker: use SortedSet for the scratch variant...
marmoute -
r49878:5a24bb7f default
parent child Browse files
Show More
@@ -15,6 +15,10 b' from mercurial import ('
15 15 smartset,
16 16 )
17 17
18 import sortedcontainers
19
20 SortedSet = sortedcontainers.SortedSet
21
18 22 revsetpredicate = registrar.revsetpredicate()
19 23
20 24
@@ -78,7 +82,7 b' def scratch(repo, subset, x):'
78 82 n = revsetlang.getinteger(n, _(b"scratch expects a number"))
79 83
80 84 selected = set()
81 heads = set()
85 heads = SortedSet()
82 86 children_count = collections.defaultdict(lambda: 0)
83 87 parents = repo.changelog._uncheckedparentrevs
84 88
@@ -102,9 +106,7 b' def scratch(repo, subset, x):'
102 106 for x in range(n):
103 107 if not heads:
104 108 break
105 pickable = list(heads)
106 pickable.sort()
107 pick = rand.choice(pickable)
109 pick = rand.choice(heads)
108 110 heads.remove(pick)
109 111 assert pick not in selected
110 112 selected.add(pick)
General Comments 0
You need to be logged in to leave comments. Login now