Mercurial > evolve
changeset 4244:0e266166457f
safeguard: check auto-publish value before sending listkeys command
Always sending listkeys command is just wasteful, let's first make sure users
even care about auto-publish behavior.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Mon, 05 Nov 2018 16:04:01 +0800 |
parents | e49af4917a6b |
children | 419801742d08 |
files | hgext3rd/evolve/safeguard.py tests/test-discovery-obshashrange.t |
diffstat | 2 files changed, 3 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/safeguard.py Sat Nov 10 17:54:28 2018 +0100 +++ b/hgext3rd/evolve/safeguard.py Mon Nov 05 16:04:01 2018 +0800 @@ -26,9 +26,11 @@ def checkpush(self, pushop): super(noautopublishrepo, self).checkpush(pushop) behavior = self.ui.config('experimental', 'auto-publish', 'default') + if behavior not in ('warn', 'abort'): + return remotephases = pushop.remote.listkeys('phases') publishing = remotephases.get('publishing', False) - if behavior in ('warn', 'abort') and publishing: + if publishing: if pushop.revs is None: published = self.filtered('served').revs("not public()") else:
--- a/tests/test-discovery-obshashrange.t Sat Nov 10 17:54:28 2018 +0100 +++ b/tests/test-discovery-obshashrange.t Mon Nov 05 16:04:01 2018 +0800 @@ -190,9 +190,6 @@ remote: capabilities: _evoext_getbundle_obscommon _evoext_obshash_0 _evoext_obshash_1 _evoext_obshashrange_v1 batch * (glob) remote: 1 sending protocaps command - preparing listkeys for "phases" - sending listkeys command - received listkey for "phases": 58 bytes query 1; heads sending batch command searching for changes @@ -322,9 +319,6 @@ * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> remote: capabilities: _evoext_getbundle_obscommon _evoext_obshash_0 _evoext_obshash_1 _evoext_obshashrange_v1 batch branchmap bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Aobsmarkers%3DV0%2CV1%0Aphases%3Dheads%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps%0Arev-branch-cache%0Astream%3Dv2 changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> remote: 1 (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> sending protocaps command (glob) - * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> preparing listkeys for "phases" (glob) - * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> sending listkeys command (glob) - * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> received listkey for "phases": 58 bytes (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> query 1; heads (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> sending batch command (glob) * @45f8b879de922f6a6e620ba04205730335b6fc7e (*)> taking quick initial sample (glob)