sapling/tests/test-pushvars-remotenames.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

45 lines
1.1 KiB
Perl

Setup
$ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
$ export PYTHONPATH
$ $PYTHON -c 'import remotenames' || exit 80
$ extpath=`dirname $TESTDIR`
$ cat > $TESTTMP/pretxnchangegroup.sh << EOF
> #!/bin/bash
> env | grep -E "^HG_USERVAR"
> exit 0
> EOF
$ chmod +x $TESTTMP/pretxnchangegroup.sh
$ cp $extpath/pushvars.py $TESTTMP # use $TESTTMP substitution in message
$ cat >> $HGRCPATH << EOF
> [extensions]
> bundle2hooks=
> pushvars=
> remotenames=
> [hooks]
> pretxnchangegroup = $TESTTMP/pretxnchangegroup.sh
> EOF
$ hg init server
$ cd server
$ echo x > x
$ hg commit -qAm x
$ hg book master
$ cd ..
$ hg clone -q server client
$ cd client
$ echo x >> x
$ hg commit -m x
Remotenames should not interfere with pushvars
$ hg push --to master --debug --pushvars MYPUSHVAR=true 2>&1 | egrep -i '(USERVAR|pushvar)'
pushing rev c73f3db8c9d2 to destination $TESTTMP/server bookmark master
bundle2-output-part: "pushvars" (params: 0 advisory) empty payload
bundle2-input-part: "pushvars" (params: 0 advisory) supported
running hook pretxnchangegroup: $TESTTMP/pretxnchangegroup.sh
HG_USERVAR_MYPUSHVAR=true