sapling/tests/test-pushvars-remotenames.t
Jun Wu 3884602d28 check-code: enfore checking before using common foreign extensions
Summary:
It's a common mistake that our tests require foreign extensions (namely evolve
and remotenames) without checking them first.

This diff adds checks to catch these mistakes, adds missing checks, and unifies
our checking logic using `require-ext.sh`, which is aware of `hgext3rd` and
prints skip message.

This affects `arc lint` so hopefully our new testing code would be free of this
kind of mistakes.

Test Plan: `arc lint` would catch errors

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3550977

Signature: t1:3550977:1468455857:e849dfd9e3cbc446cc6e6c662050ee88a3366e6c
2016-07-12 20:39:34 +01:00

46 lines
1.1 KiB
Perl

$ . $TESTDIR/require-ext.sh remotenames
Setup
$ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
$ export PYTHONPATH
$ 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/hgext3rd/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