comparison tests/test-pushvars.t @ 34476: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
children 4f8c241b2bfa
comparison
equal deleted inserted replaced
34475:f100354cce52 34476:db3dc11356ed
1 Setup
2
3 $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
4 $ export PYTHONPATH
5
6 $ cat > $TESTTMP/pretxnchangegroup.sh << EOF
7 > #!/bin/sh
8 > env | egrep "^HG_USERVAR_(DEBUG|BYPASS_REVIEW)" | sort
9 > exit 0
10 > EOF
11 $ chmod +x $TESTTMP/pretxnchangegroup.sh
12 $ cat >> $HGRCPATH << EOF
13 > [hooks]
14 > pretxnchangegroup = $TESTTMP/pretxnchangegroup.sh
15 > [experimental]
16 > bundle2-exp = true
17 > EOF
18
19 $ hg init repo
20 $ hg clone -q repo child
21 $ cd child
22
23 Test pushing vars to repo with pushvars.server not set
24
25 $ echo b > a
26 $ hg commit -Aqm a
27 $ hg push --pushvars "DEBUG=1" --pushvars "BYPASS_REVIEW=true"
28 pushing to $TESTTMP/repo (glob)
29 searching for changes
30 adding changesets
31 adding manifests
32 adding file changes
33 added 1 changesets with 1 changes to 1 files
34
35 Setting pushvars.sever = true and then pushing.
36
37 $ echo [push] >> $HGRCPATH
38 $ echo "pushvars.server = true" >> $HGRCPATH
39 $ echo b >> a
40 $ hg commit -Aqm a
41 $ hg push --pushvars "DEBUG=1" --pushvars "BYPASS_REVIEW=true"
42 pushing to $TESTTMP/repo (glob)
43 searching for changes
44 adding changesets
45 adding manifests
46 adding file changes
47 added 1 changesets with 1 changes to 1 files
48 HG_USERVAR_BYPASS_REVIEW=true
49 HG_USERVAR_DEBUG=1
50
51 Test pushing var with empty right-hand side
52
53 $ echo b >> a
54 $ hg commit -Aqm a
55 $ hg push --pushvars "DEBUG="
56 pushing to $TESTTMP/repo (glob)
57 searching for changes
58 adding changesets
59 adding manifests
60 adding file changes
61 added 1 changesets with 1 changes to 1 files
62 HG_USERVAR_DEBUG=
63
64 Test pushing bad vars
65
66 $ echo b >> a
67 $ hg commit -Aqm b
68 $ hg push --pushvars "DEBUG"
69 pushing to $TESTTMP/repo (glob)
70 abort: unable to parse variable 'DEBUG', should follow 'KEY=VALUE' or 'KEY=' format
71 [255]