comparison mercurial/debugcommands.py @ 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 d121823072b8
children d31d8c5279c6
comparison
equal deleted inserted replaced
42029:19ccc6788a27 42030:6ae1a776dd1a
770 @command('debugdiscovery', 770 @command('debugdiscovery',
771 [('', 'old', None, _('use old-style discovery')), 771 [('', 'old', None, _('use old-style discovery')),
772 ('', 'nonheads', None, 772 ('', 'nonheads', None,
773 _('use old-style discovery with non-heads included')), 773 _('use old-style discovery with non-heads included')),
774 ('', 'rev', [], 'restrict discovery to this set of revs'), 774 ('', 'rev', [], 'restrict discovery to this set of revs'),
775 ('', 'seed', '12323', 'specify the random seed use for discovery'),
775 ] + cmdutil.remoteopts, 776 ] + cmdutil.remoteopts,
776 _('[--rev REV] [OTHER]')) 777 _('[--rev REV] [OTHER]'))
777 def debugdiscovery(ui, repo, remoteurl="default", **opts): 778 def debugdiscovery(ui, repo, remoteurl="default", **opts):
778 """runs the changeset discovery protocol in isolation""" 779 """runs the changeset discovery protocol in isolation"""
779 opts = pycompat.byteskwargs(opts) 780 opts = pycompat.byteskwargs(opts)
780 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl)) 781 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl))
781 remote = hg.peer(repo, opts, remoteurl) 782 remote = hg.peer(repo, opts, remoteurl)
782 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl)) 783 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
783 784
784 # make sure tests are repeatable 785 # make sure tests are repeatable
785 random.seed(12323) 786 random.seed(int(opts['seed']))
786 787
787 def doit(pushedrevs, remoteheads, remote=remote): 788 def doit(pushedrevs, remoteheads, remote=remote):
788 if opts.get('old'): 789 if opts.get('old'):
789 if not util.safehasattr(remote, 'branches'): 790 if not util.safehasattr(remote, 'branches'):
790 # enable in-client legacy support 791 # enable in-client legacy support