Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 33693: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 |
comparison
equal
deleted
inserted
replaced
33692:f100354cce52 | 33693:db3dc11356ed |
---|---|
1877 cache.setfnode(node, fnode) | 1877 cache.setfnode(node, fnode) |
1878 count += 1 | 1878 count += 1 |
1879 | 1879 |
1880 cache.write() | 1880 cache.write() |
1881 op.ui.debug('applied %i hgtags fnodes cache entries\n' % count) | 1881 op.ui.debug('applied %i hgtags fnodes cache entries\n' % count) |
1882 | |
1883 @parthandler('pushvars') | |
1884 def bundle2getvars(op, part): | |
1885 '''unbundle a bundle2 containing shellvars on the server''' | |
1886 # An option to disable unbundling on server-side for security reasons | |
1887 if op.ui.configbool('push', 'pushvars.server', False): | |
1888 hookargs = {} | |
1889 for key, value in part.advisoryparams: | |
1890 key = key.upper() | |
1891 # We want pushed variables to have USERVAR_ prepended so we know | |
1892 # they came from the --pushvar flag. | |
1893 key = "USERVAR_" + key | |
1894 hookargs[key] = value | |
1895 op.addhookargs(hookargs) |