changeset 42030:6ae1a776dd1a

debugdiscovery: allow to select random seed during debugdiscovery run The randomness can lead to large timing difference, controling it is important.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 26 Mar 2019 14:02:40 +0100
parents 19ccc6788a27
children d31d8c5279c6
files mercurial/debugcommands.py tests/test-completion.t
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Sun Mar 17 18:45:53 2019 +0300
+++ b/mercurial/debugcommands.py	Tue Mar 26 14:02:40 2019 +0100
@@ -772,6 +772,7 @@
     ('', '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 @@
     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'):
--- a/tests/test-completion.t	Sun Mar 17 18:45:53 2019 +0300
+++ b/tests/test-completion.t	Tue Mar 26 14:02:40 2019 +0100
@@ -263,7 +263,7 @@
   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