sapling/tests/test-pushvars.t
Tony Tung 7061c1092f store the pushvars in the bundle2 operation object
Summary:
The pushvars extension ensures that it precedes the hooks.
Unfortunately, that means pushrebase does not have access to the hook
variables unless it obtains the transaction.  If it does that, then the
prepushrebase step will have the lock, defeating the purpose of the hook.

By storing the pushvars in the operation, we can retrieve it without
starting the transaction.

Test Plan: passes the BYPASS_REVIEW test when it is moved to prepushrebase

Reviewers: #sourcecontrol, durham, lcharignon

Reviewed By: durham

Subscribers: durham, mitrandir

Differential Revision: https://phabricator.fb.com/D2890191

Tasks: 9872386

Signature: t1:2890191:1454526611:503a30015494eef467ad545b92077bf42cdd30d5
2016-02-18 21:32:11 -08:00

65 lines
1.5 KiB
Perl

Setup
$ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
$ export PYTHONPATH
$ extpath=`dirname $TESTDIR`
$ cat > $TESTTMP/pretxnchangegroup.sh << EOF
> #!/bin/bash
> env | grep -E "^HG_USERVAR_DEBUG"
> env | grep -E "^HG_USERVAR_BYPASS_REVIEW"
> exit 0
> EOF
$ chmod +x $TESTTMP/pretxnchangegroup.sh
$ cp $extpath/pushvars.py $TESTTMP # use $TESTTMP substitution in message
$ cat >> $HGRCPATH << EOF
> [extensions]
> bundle2hooks=
> pushvars=
> [hooks]
> pretxnchangegroup = $TESTTMP/pretxnchangegroup.sh
> [experimental]
> bundle2-exp = true
> EOF
$ hg init repo
$ hg clone -q repo child
$ cd child
Test pushing vars to repo
$ echo b > a
$ hg commit -Aqm a
$ hg push --pushvars "DEBUG=1" --pushvars "BYPASS_REVIEW=true"
pushing to $TESTTMP/repo (glob)
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
HG_USERVAR_DEBUG=1
HG_USERVAR_BYPASS_REVIEW=true
Test pushing var with empty right-hand side
$ echo b >> a
$ hg commit -Aqm a
$ hg push --pushvars "DEBUG="
pushing to $TESTTMP/repo (glob)
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
HG_USERVAR_DEBUG=
Test pushing bad vars
$ echo b >> a
$ hg commit -Aqm b
$ hg push --pushvars "DEBUG"
pushing to $TESTTMP/repo (glob)
searching for changes
abort: passed in variable needs to be of form var= or var=val. Instead, this was given "DEBUG"
[255]