[PATCH 1 of 6 "] debugdiscovery: allow to select random seed during debugdiscovery run

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Mar 26 13:04:54 EDT 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1553605360 -3600
#      Tue Mar 26 14:02:40 2019 +0100
# Node ID 86368c692741cc1c8484a1e43f25f0dc9186496e
# Parent  ba064f95175e6cb1467401a3a536d8c32229d4b1
# EXP-Topic debug-discovery
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 86368c692741
debugdiscovery: allow to select random seed during debugdiscovery run

The randomness can lead to large timing difference, controling it is important.

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -772,6 +772,7 @@ def debugstate(ui, repo, **opts):
     ('', 'nonheads', None,
      _('use old-style discovery with non-heads included')),
     ('', 'rev', [], 'restrict discovery to this set of revs'),
+    ('', 'seed', '12323', 'restrict discovery to this set of revs'),
     ] + cmdutil.remoteopts,
     _('[--rev REV] [OTHER]'))
 def debugdiscovery(ui, repo, remoteurl="default", **opts):
@@ -782,7 +783,7 @@ def debugdiscovery(ui, repo, remoteurl="
     ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
 
     # make sure tests are repeatable
-    random.seed(12323)
+    random.seed(int(opts['seed']))
 
     def doit(pushedrevs, remoteheads, remote=remote):
         if opts.get('old'):
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -263,7 +263,7 @@ Show all commands + options
   debugdate: extended
   debugdeltachain: changelog, manifest, dir, template
   debugdirstate: nodates, dates, datesort
-  debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
+  debugdiscovery: old, nonheads, rev, seed, ssh, remotecmd, insecure
   debugdownload: output
   debugextensions: template
   debugfileset: rev, all-files, show-matcher, show-stage


More information about the Mercurial-devel mailing list