changeset 3258:544354cfc626

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 26 Oct 2017 08:44:50 +0200
parents ddfdef7e9b58
children 406992d0d611
files CHANGELOG hgext3rd/evolve/obsexchange.py
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
+++ b/hgext3rd/evolve/obsexchange.py
@@ -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)