pushkey: forbid usage of pushley to exchange markers
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 26 Oct 2017 08:44:50 +0200
changeset 3153 544354cfc626
parent 3152 ddfdef7e9b58
child 3154 406992d0d611
pushkey: forbid usage of pushley to exchange markers The pushkey based protocol lacks many important feature and is very slow. We disable it to prevent any usage by mistake.
CHANGELOG
hgext3rd/evolve/obsexchange.py
--- a/CHANGELOG	Thu Oct 26 08:29:36 2017 +0200
+++ b/CHANGELOG	Thu Oct 26 08:44:50 2017 +0200
@@ -6,6 +6,7 @@
 
   * 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,
 
 6.8.0 -- 2017-10-23
 -------------------
--- a/hgext3rd/evolve/obsexchange.py	Thu Oct 26 08:29:36 2017 +0200
+++ b/hgext3rd/evolve/obsexchange.py	Thu Oct 26 08:44:50 2017 +0200
@@ -16,11 +16,13 @@
 
 from mercurial import (
     bundle2,
+    error,
     exchange,
     extensions,
     lock as lockmod,
     node,
     obsolete,
+    pushkey,
     util,
     wireproto,
 )
@@ -191,3 +193,14 @@
     finaldata.write(obsdata)
     finaldata.seek(0)
     return wireproto.streamres(reader=finaldata, v1compressible=True)
+
+abortmsg = "won't exchange obsmarkers through pushkey"
+hint = "upgrade your client or server to use the bundle2 protocol"
+
+def forbidpushkey(repo=None, key=None, old=None, new=None):
+    """prevent exchange through pushkey"""
+    raise error.Abort(abortmsg, hint=hint)
+
+@eh.uisetup
+def setuppushkeyforbidding(ui):
+    pushkey._namespaces['obsolete'] = (forbidpushkey, forbidpushkey)