changeset 3281:1b58e0121689 mercurial-4.3

test-compat: merge stable into mercurial-4.3
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 07 Nov 2017 13:05:37 +0100
parents e1a230cc4527 (current diff) d56b8f5f0bb1 (diff)
children a7050ab9d8c1 68aeeb4d4b8f
files tests/test-wireproto.t
diffstat 9 files changed, 73 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags
+++ b/.hgtags
@@ -59,3 +59,4 @@
 3a4f75c6619c7ef7d78ee0912efd6cb01d55b521 6.7.0
 430ad68292d76b9387d1eeadf289951f51fd88d3 6.7.1
 ec0bbf26ce7fadd42c637e01d3750dac96ac0b1b 6.8.0
+c56c028f3802202241551e5953bea74ab3a6c434 7.0.0
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,22 +1,32 @@
 Changelog
 =========
 
-7.0.0 - in progress
+7.0.1 - in progress
+-------------------
+
+  * obsdiscovery: allow the config option to disable discovery server side
+    (it was previously only honored on the client side)
+
+  * server: avoid exposing 'abort' to evolution enabled client talking
+            to server with the extension bu obsolescence marker exchange
+            disabled.
+
+7.0.0 -- 2017-10-23
 -------------------
 
   * drop compatibility with Mercurial 3.8, 3.9 and 4.0,
   * drop support for old and deprecated method to exchange obsmarkers,
   * forbid usage of the old pushbey based protocol to exchange obsmarkers,
-  * evolve: rename '--contentdivergent' flag to '--content-divergent'
-  * evolve: rename '--phasedivergent' flag to '--phase-divergent'
+  * evolve: rename '--contentdivergent' flag to '--content-divergent',
+  * evolve: rename '--phasedivergent' flag to '--phase-divergent'.
 
-topic
+topic (0.5.0)
 
   * add an experimental flag to enforce one head per name policy,
     (off by default, see 'hg help -e topic' for details)
   * add an experimental flag to have changesets without topic published on push,
     (off by default, see 'hg help -e topic' for details)
-  * add a '--publish' flag to `hg push` (4.4+ only),
+  * add a '--publish' flag to `hg push` (4.4+ only).
 
 6.8.0 -- 2017-10-23
 -------------------
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,10 @@
-mercurial-evolve (6.8.0-1) UNRELEASED; urgency=medium
+mercurial-evolve (7.0.0-1) unstable; urgency=medium
+
+  * new upstream release
+
+ -- Pierre-Yves David <pierre-yves.david@ens-lyon.org>  Thu, 02 Nov 2017 00:30:29 +0100
+
+mercurial-evolve (6.8.0-1) unstable; urgency=medium
 
   * new upstream release
 
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@
  Pierre-Yves David <pierre-yves.david@logilab.fr>,
 Standards-Version: 3.9.3
 Build-Depends:
- mercurial (>= 3.4~),
+ mercurial (>= 4.1),
  python,
  debhelper (>= 8),
  python-sphinx (>= 1.0.8),
@@ -22,19 +22,12 @@
 Depends:
  ${python:Depends},
  ${misc:Depends},
- mercurial (>= 3.3~),
+ mercurial (>= 4.1),
 Description: evolve extension for Mercurial
  This package provides the experimental "evolve" extension for the Mercurial
  DVCS.
  .
  This extension provides several commands to mutate history and deal with issues
  it may raise.
- .
- It also:
-  - enables the "Changeset Obsolescence" feature of mercurial,
-  - alters core command and extension that rewrite history to use this feature,
-  - improves some aspects of the early implementation in Mercurial 2.3.
- .
- **These extensions are experimental and are not meant for production.**
 
 
--- a/hgext3rd/evolve/metadata.py
+++ b/hgext3rd/evolve/metadata.py
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-__version__ = '7.0.0.dev'
+__version__ = '7.0.1.dev'
 testedwith = '4.1.3 4.2.3 4.3.2 4.4'
 minimumhgversion = '4.1'
 buglink = 'https://bz.mercurial-scm.org/'
--- a/hgext3rd/evolve/obsdiscovery.py
+++ b/hgext3rd/evolve/obsdiscovery.py
@@ -820,7 +820,8 @@
 def _obshash_capabilities(orig, repo, proto):
     """wrapper to advertise new capability"""
     caps = orig(repo, proto)
-    if obsolete.isenabled(repo, obsolete.exchangeopt):
+    if (obsolete.isenabled(repo, obsolete.exchangeopt)
+        and repo.ui.configbool('experimental', 'evolution.obsdiscovery', True)):
         caps = caps.split()
         caps.append('_evoext_obshash_0')
         caps.append('_evoext_obshash_1')
--- a/hgext3rd/evolve/obsexchange.py
+++ b/hgext3rd/evolve/obsexchange.py
@@ -27,6 +27,8 @@
     wireproto,
 )
 
+from mercurial.hgweb import common as hgwebcommon
+
 from . import (
     exthelper,
     utility,
@@ -197,10 +199,25 @@
 abortmsg = "won't exchange obsmarkers through pushkey"
 hint = "upgrade your client or server to use the bundle2 protocol"
 
+class HTTPCompatibleAbort(hgwebcommon.ErrorResponse, error.Abort):
+    def __init__(self, message, code, hint=None):
+        # initialisation of each class is a bit messy.
+        # We explicitly do the dispatch
+        hgwebcommon.ErrorResponse.__init__(self, 410, message)
+        error.Abort.__init__(self, message, hint=hint)
+
 def forbidpushkey(repo=None, key=None, old=None, new=None):
     """prevent exchange through pushkey"""
-    raise error.Abort(abortmsg, hint=hint)
+    err = HTTPCompatibleAbort(abortmsg, 410, hint=hint)
+    raise err
+
+def forbidlistkey(repo=None, key=None, old=None, new=None):
+    """prevent exchange through pushkey"""
+    if obsolete.isenabled(repo, obsolete.exchangeopt):
+        err = HTTPCompatibleAbort(abortmsg, 410, hint=hint)
+        raise err
+    return {}
 
 @eh.uisetup
 def setuppushkeyforbidding(ui):
-    pushkey._namespaces['obsolete'] = (forbidpushkey, forbidpushkey)
+    pushkey._namespaces['obsolete'] = (forbidpushkey, forbidlistkey)
--- a/hgext3rd/topic/__init__.py
+++ b/hgext3rd/topic/__init__.py
@@ -174,7 +174,7 @@
               'topic.active': 'green',
              }
 
-__version__ = '0.5.0.dev'
+__version__ = '0.5.1.dev'
 
 testedwith = '4.1.3 4.2.3 4.3.3 4.4'
 minimumhgversion = '4.1'
--- a/tests/test-wireproto.t
+++ b/tests/test-wireproto.t
@@ -184,3 +184,28 @@
   obsmarker-exchange: 376 bytes received
 
   $ cd ..
+
+And disable it server side too:
+
+  $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log  --config experimental.evolution.obsdiscovery=no
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ curl -s http://localhost:$HGPORT/?cmd=capabilities
+  _evoext_getbundle_obscommon batch branchmap bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Aobsmarkers%3DV0%2CV1%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps changegroupsubset compression=zstd,zlib getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-eol)
+
+Check we cannot use pushkey for marker exchange anymore
+
+  $ hg debugpushkey http://localhost:$HGPORT/ obsolete
+  abort: HTTP Error 410: won't exchange obsmarkers through pushkey
+  [255]
+  $ hg debugpushkey ssh://user@dummy/server obsolete
+  remote: abort: won't exchange obsmarkers through pushkey
+  remote: (upgrade your client or server to use the bundle2 protocol)
+  abort: unexpected response: empty string
+  [255]
+
+But we do let it goes fine on repository with exchange disabled:
+
+  $ $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
+  $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log  --config experimental.evolution='!'
+  $ hg debugpushkey http://localhost:$HGPORT/ obsolete