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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Mar 27 07:23:09 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 9ed78aeb439439b95c218d097f17f0416cb21129
# Parent  00c1ee0f746a5f427e81e6d18e681f6a70a2639d
# EXP-Topic debug-discovery
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 9ed78aeb4394
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', 'specify the random seed use for discovery'),
     ] + 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