diff mercurial/exchange.py @ 33719:db3dc11356ed

pushvars: move fb extension pushvars to core pushvars extension in fbext adds a --pushvars flag to push command using which one send strings to server which becomes environment variables there prepended with HG_USERVAR_. These variables can then be used to run hooks on the server. The extension is moved directly to core and unbundling of the strings and converting them to environment variables at server is disabled by default for security reasons. One can turn that on by following config: [push] pushvars.server = true This patch also adds the test for the extension. Differential Revision: https://phab.mercurial-scm.org/D210
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 31 Jul 2017 09:59:42 +0530
parents 9c27a2891b75
children fda0867cfe03
line wrap: on
line diff
--- a/mercurial/exchange.py	Fri Aug 04 12:21:23 2017 -0700
+++ b/mercurial/exchange.py	Mon Jul 31 09:59:42 2017 +0530
@@ -893,6 +893,14 @@
                         pushop.bkresult = 1
     return handlereply
 
+@b2partsgenerator('pushvars', idx=0)
+def _getbundlesendvars(pushop, bundler):
+    '''send shellvars via bundle2'''
+    if getattr(pushop.repo, '_shellvars', ()):
+        part = bundler.newpart('pushvars')
+
+        for key, value in pushop.repo._shellvars.iteritems():
+            part.addparam(key, value, mandatory=False)
 
 def _pushbundle2(pushop):
     """push data to the remote using bundle2