# HG changeset patch # User Anton Shestakov # Date 1541405041 -28800 # Node ID 0e266166457fd6203eaa4c63c3c2fbd07a2a844f # Parent e49af4917a6b882ec37efbbb773295ab02f5b6e2 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. diff -r e49af4917a6b -r 0e266166457f hgext3rd/evolve/safeguard.py --- 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: diff -r e49af4917a6b -r 0e266166457f tests/test-discovery-obshashrange.t --- 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)