sapling/tests/test-pushvars.t
Jun Wu 3d461ae600 check-ext: make checks stricter
Summary:
Enhance check-ext script to be more strict:

 - Only one foreign extension is allowed: `remotenames`
 - Require explicit path for in-repo extensions to avoid wrong extensions
   being tested

This would make the test more predicatable since system extensions
will be less likely to be imported. Explicit path is better than
setting `PYTHONPATH` since `hgext/name.py` could override
`hgext3rd/name.py` regardless of `PYTHONPATH`.

Test Plan: arc unit

Reviewers: phillco, durham, ikostia, #mercurial, stash

Reviewed By: stash

Subscribers: medson, mjpieters

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

Signature: t1:5271430:1497861776:7dd35ec7c522cd9b26aa0871cb4306b4f1b8993a
2017-06-19 08:02:38 -07:00

63 lines
1.5 KiB
Perl

Setup
$ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
$ export PYTHONPATH
$ 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
$ cat >> $HGRCPATH << EOF
> [extensions]
> bundle2hooks=$TESTDIR/../hgext3rd/bundle2hooks.py
> pushvars=$TESTDIR/../hgext3rd/pushvars.py
> [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]