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

login
register
mail settings
Submitter Pierre-Yves David
Date March 26, 2019, 5:04 p.m.
Message ID <86368c692741cc1c8484.1553619894@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39387/
State Superseded
Headers show

Comments

Pierre-Yves David - March 26, 2019, 5:04 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.
Pierre-Yves David - March 27, 2019, 11:14 a.m.
On 3/26/19 5:04 PM, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@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'),

Boris pointed me out that I forgot to update the doc. V2 coming.

Patch

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