D12394: subsetmaker: stabilize the computation of `scratch` subset

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Tue Mar 22 07:06:07 UTC 2022


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `heads` is set, order of the element are not deterministic and we need to
  stabilize that if we want to get reproducible results.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12394

AFFECTED FILES
  contrib/perf-utils/subsetmaker.py

CHANGE DETAILS

diff --git a/contrib/perf-utils/subsetmaker.py b/contrib/perf-utils/subsetmaker.py
--- a/contrib/perf-utils/subsetmaker.py
+++ b/contrib/perf-utils/subsetmaker.py
@@ -102,7 +102,9 @@
     for x in range(n):
         if not heads:
             break
-        pick = rand.choice(list(heads))
+        pickable = list(heads)
+        pickable.sort()
+        pick = rand.choice(pickable)
         heads.remove(pick)
         assert pick not in selected
         selected.add(pick)



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list