# HG changeset patch # User Pierre-Yves David # Date 1496158359 -7200 # Node ID 29fc90b0e59ce28c7ba4779dde44972128eba588 # Parent 5fb5d096348cfbe69ab63df05f935c1b14791a01 obsdiscovery: add an option to disable all obsdiscovery On large repository, computing the obshashtree can we as slow as resending everything. We give the option for people to opt out. diff -r 5fb5d096348c -r 29fc90b0e59c README --- a/README Tue May 30 11:39:45 2017 +0200 +++ b/README Tue May 30 17:32:39 2017 +0200 @@ -119,6 +119,8 @@ - olog: add an '--all' option to show the whole obsolescence history tree. - evolution: add an experiment to track the effect of rewrites. (See hg help - evolve for details) + - obsdiscovery: add a config flag to disable all obsmarkers discovery + (See hg help - evolve for details) - template: add a 'precursors' template that display the closests precursors of changesets - template: add a 'successors' template that display the closests successors of changesets - template: add a 'obsfate' template that display how a changeset has evolved diff -r 5fb5d096348c -r 29fc90b0e59c hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Tue May 30 11:39:45 2017 +0200 +++ b/hgext3rd/evolve/__init__.py Tue May 30 17:32:39 2017 +0200 @@ -44,6 +44,12 @@ # * abort: abort the push auto-publish = ignore + # For some large repository with few markers, the current for obsolescence + # markers discovery can get in the way. You can disable it with the + # configuration option below. This means all pushes and pulls will + # re-exchange all markers every time. + evolution.obsdiscovery = yes + Obsolescence Markers Discovery Experiment ========================================= diff -r 5fb5d096348c -r 29fc90b0e59c hgext3rd/evolve/obsdiscovery.py --- a/hgext3rd/evolve/obsdiscovery.py Tue May 30 11:39:45 2017 +0200 +++ b/hgext3rd/evolve/obsdiscovery.py Tue May 30 17:32:39 2017 +0200 @@ -872,6 +872,14 @@ (_canobshashtree, _pushobshashtree), ] +obsdiscovery_skip_message = """\ +(skipping discovery of obsolescence markers, will exchange everything) +(controled by 'experimental.evolution.obsdiscovery' configuration) +""" + +def usediscovery(repo): + return repo.ui.configbool('experimental', 'evolution.obsdiscovery', True) + @eh.wrapfunction(exchange, '_pushdiscoveryobsmarkers') def _pushdiscoveryobsmarkers(orig, pushop): if _dopushmarkers(pushop): @@ -881,6 +889,11 @@ revs = list(repo.revs('::%ln', pushop.futureheads)) unfi = repo.unfiltered() + if not usediscovery(repo): + # discovery disabled by user + repo.ui.status(obsdiscovery_skip_message) + return orig(pushop) + # look for an obs-discovery protocol we can use discovery = None for candidate in obsdiscoveries: @@ -929,6 +942,12 @@ boundaries['common'] = [node.nullid] return boundaries + if not usediscovery(repo): + # discovery disabled by users. + repo.ui.status(obsdiscovery_skip_message) + boundaries['common'] = [node.nullid] + return boundaries + if bundle2 and _canobshashrange(repo, remote): obsexcmsg(repo.ui, "looking for common markers in %i nodes\n" % len(revs)) diff -r 5fb5d096348c -r 29fc90b0e59c tests/test-wireproto.t --- a/tests/test-wireproto.t Tue May 30 11:39:45 2017 +0200 +++ b/tests/test-wireproto.t Tue May 30 17:32:39 2017 +0200 @@ -149,4 +149,34 @@ 1 new obsolescence markers (run 'hg heads' to see heads) +test discovery avoid exchanging known markers + + $ hg push + pushing to ssh://user@dummy/server + searching for changes + no changes found + [1] + $ hg -R ../other pull + pulling from ssh://user@dummy/server + searching for changes + no changes found + +test discovery can be disabled + + $ hg push --config experimental.evolution.obsdiscovery=no + pushing to ssh://user@dummy/server + searching for changes + (skipping discovery of obsolescence markers, will exchange everything) + (controled by 'experimental.evolution.obsdiscovery' configuration) + no changes found + remote: obsmarker-exchange: 346 bytes received + [1] + $ hg -R ../other pull --config experimental.evolution.obsdiscovery=no + pulling from ssh://user@dummy/server + searching for changes + no changes found + (skipping discovery of obsolescence markers, will exchange everything) + (controled by 'experimental.evolution.obsdiscovery' configuration) + obsmarker-exchange: 346 bytes received + $ cd ..