Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bundle2.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 | 1d5e497c08b3 |
children | 373ca5103ba8 |
line wrap: on
line diff
--- a/mercurial/bundle2.py Fri Aug 04 12:21:23 2017 -0700 +++ b/mercurial/bundle2.py Mon Jul 31 09:59:42 2017 +0530 @@ -1879,3 +1879,17 @@ cache.write() op.ui.debug('applied %i hgtags fnodes cache entries\n' % count) + +@parthandler('pushvars') +def bundle2getvars(op, part): + '''unbundle a bundle2 containing shellvars on the server''' + # An option to disable unbundling on server-side for security reasons + if op.ui.configbool('push', 'pushvars.server', False): + hookargs = {} + for key, value in part.advisoryparams: + key = key.upper() + # We want pushed variables to have USERVAR_ prepended so we know + # they came from the --pushvar flag. + key = "USERVAR_" + key + hookargs[key] = value + op.addhookargs(hookargs)