mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
effa0da8de
Summary: The helper could be used in individual tests to enable chg if chg exists. This allows us to have more precise control on what tests to use chg instead of using a global flag in run-tests.py. This makes certain tests containing many hg commands much faster. For example, `test-revset.t` took 99 seconds before: % ./run-tests.py test-revset.t --time . # Ran 1 tests, 0 skipped, 0 failed. # Producing time report start end cuser csys real Test 0.000 99.990 86.410 12.000 99.990 test-revset.t And 10 seconds after: % ./run-tests.py test-revset.t --time . # Ran 1 tests, 0 skipped, 0 failed. # Producing time report start end cuser csys real Test 0.000 10.080 0.380 0.130 10.080 test-revset.t Also enable it for some other tests. Note the whitelist is not complete. We probably want to whitelist more tests in the future. The feature could be opted out by deleting `contrib/chg/chg`. Reviewed By: phillco Differential Revision: D6767036 fbshipit-source-id: 8220cf408aa198d5d8e2ca5127ca60e2070d3444
74 lines
1.7 KiB
Perl
74 lines
1.7 KiB
Perl
$ . helpers-usechg.sh
|
|
|
|
Setup
|
|
|
|
$ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
|
|
$ export PYTHONPATH
|
|
|
|
$ cat > $TESTTMP/pretxnchangegroup.sh << EOF
|
|
> #!/bin/sh
|
|
> env | egrep "^HG_USERVAR_(DEBUG|BYPASS_REVIEW)" | sort
|
|
> exit 0
|
|
> EOF
|
|
$ cat >> $HGRCPATH << EOF
|
|
> [hooks]
|
|
> pretxnchangegroup = sh $TESTTMP/pretxnchangegroup.sh
|
|
> [experimental]
|
|
> bundle2-exp = true
|
|
> EOF
|
|
|
|
$ hg init repo
|
|
$ hg clone -q repo child
|
|
$ cd child
|
|
|
|
Test pushing vars to repo with pushvars.server not set
|
|
|
|
$ echo b > a
|
|
$ hg commit -Aqm a
|
|
$ hg push --pushvars "DEBUG=1" --pushvars "BYPASS_REVIEW=true"
|
|
pushing to $TESTTMP/repo
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files
|
|
|
|
Setting pushvars.sever = true and then pushing.
|
|
|
|
$ echo [push] >> $HGRCPATH
|
|
$ echo "pushvars.server = true" >> $HGRCPATH
|
|
$ echo b >> a
|
|
$ hg commit -Aqm a
|
|
$ hg push --pushvars "DEBUG=1" --pushvars "BYPASS_REVIEW=true"
|
|
pushing to $TESTTMP/repo
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files
|
|
HG_USERVAR_BYPASS_REVIEW=true
|
|
HG_USERVAR_DEBUG=1
|
|
|
|
Test pushing var with empty right-hand side
|
|
|
|
$ echo b >> a
|
|
$ hg commit -Aqm a
|
|
$ hg push --pushvars "DEBUG="
|
|
pushing to $TESTTMP/repo
|
|
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
|
|
searching for changes
|
|
abort: unable to parse variable 'DEBUG', should follow 'KEY=VALUE' or 'KEY=' format
|
|
[255]
|