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 |