3e2223a544db — Tony Tung 8 years ago
[pushrebase] change the pushrebase tests to use the PYTHONPATH setup

Summary: Just a bit cleaner.  Also this makes it so pushrebase can source any hypothetically shared code.  Mostly because I'm too lazy to type bundle2hooks=PATH_OF_FILE.

Test Plan: same unit tests pass.

Reviewers: #sourcecontrol, durham

Reviewed By: durham

Subscribers: durham, mitrandir

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

Signature: t1:2903928:1454648999:81f6cc64f708dc4709640b2a214e1b3dbc11caa5
M tests/test-pull-createmarkers.t +6 -1
@@ 1,3 1,8 @@ 
+Setup
+
+  $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
+  $ export PYTHONPATH
+
 Test that hg pull creates obsolescence markers for landed diffs
   $ $PYTHON -c 'import remotenames' || exit 80
   $ cat >> $HGRCPATH <<EOF

          
@@ 14,7 19,7 @@ Test that hg pull creates obsolescence m
   > strip=
   > rebase=
   > remotenames=
-  > pushrebase= $TESTDIR/../pushrebase.py
+  > pushrebase =
   > pullcreatemarkers= $TESTDIR/../pullcreatemarkers.py
   > [remotenames]
   > allownonfastforward=True

          
M tests/test-pushrebase-protection.t +7 -2
@@ 1,3 1,8 @@ 
+Setup
+
+  $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
+  $ export PYTHONPATH
+
   $ cat >> $HGRCPATH <<EOF
   > [ui]
   > ssh = python "$RUNTESTDIR/dummyssh"

          
@@ 12,7 17,7 @@ Setup pushrebase required repo
   $ cd server
   $ cat >> .hg/hgrc <<EOF
   > [extensions]
-  > pushrebase = $TESTDIR/../pushrebase.py
+  > pushrebase =
   > [pushrebase]
   > blocknonpushrebase = True
   > EOF

          
@@ 49,7 54,7 @@ Non-pushrebase pushes should be rejected
 
 Pushrebase pushes should be allowed
 
-  $ hg push --config extensions.pushrebase=$TESTDIR/../pushrebase.py --to master -B master
+  $ hg push --config 'extensions.pushrebase =' --to master -B master
   pushing to $TESTTMP/server (glob)
   searching for changes
   pushing 1 commit:

          
M tests/test-pushrebase-remotenames.t +8 -3
@@ 1,10 1,15 @@ 
+Setup
+
+  $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
+  $ export PYTHONPATH
+
   $ $PYTHON -c 'import remotenames' || exit 80
   $ cat >> $HGRCPATH << EOF
   > [ui]
   > ssh = python "$RUNTESTDIR/dummyssh"
   > [extensions]
   > remotenames =
-  > pushrebase = $TESTDIR/../pushrebase.py
+  > pushrebase=
   > [remotenames]
   > allownonfastforward=True
   > [experimental]

          
@@ 230,7 235,7 @@ Test force pushes
   $ cd forcepushserver
   $ cat >> .hg/hgrc <<EOF
   > [extensions]
-  > pushrebase = $TESTDIR/../pushrebase.py
+  > pushrebase =
   > EOF
   $ echo a > a && hg commit -Aqm a
   $ hg book master

          
@@ 245,7 250,7 @@ Test force pushes
   $ cd ../forcepushclient
   $ cat >> .hg/hgrc <<EOF
   > [extensions]
-  > pushrebase = $TESTDIR/../pushrebase.py
+  > pushrebase =
   > EOF
   $ hg up master
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved

          
M tests/test-pushrebase.t +15 -10
@@ 1,3 1,8 @@ 
+Setup
+
+  $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
+  $ export PYTHONPATH
+
   $ cat >> $HGRCPATH <<EOF
   > [ui]
   > ssh = python "$RUNTESTDIR/dummyssh"

          
@@ 30,7 35,7 @@ Set up client repository
   $ hg clone ssh://user@dummy/server client -q
   $ cd client
   $ echo "[extensions]" >> .hg/hgrc
-  $ echo "pushrebase = $TESTDIR/../pushrebase.py" >> .hg/hgrc
+  $ echo "pushrebase =" >> .hg/hgrc
 
 Without server extension
 

          
@@ 78,7 83,7 @@ Stack of non-conflicting commits should 
 
   $ cd ../server
   $ echo "[extensions]" >> .hg/hgrc
-  $ echo "pushrebase = $TESTDIR/../pushrebase.py" >> .hg/hgrc
+  $ echo "pushrebase =" >> .hg/hgrc
   $ log
   @  a => bar [draft:add0c792bfce]
   |

          
@@ 521,7 526,7 @@ Test that the prepushrebase hook can run
   > [hooks]
   > prepushrebase = $TESTTMP/prerebase.sh
   > [extensions]
-  > pushrebase = $TESTDIR/../pushrebase.py
+  > pushrebase =
   > [experimental]
   > bundle2lazylocking = True
   > EOF

          
@@ 540,7 545,7 @@ Test that the prepushrebase hook can run
   $ cd prepushrebaseclient
   $ cat >> .hg/hgrc <<EOF
   > [extensions]
-  > pushrebase = $TESTDIR/../pushrebase.py
+  > pushrebase =
   > EOF
   $ touch b && hg add b && hg commit -qm b
   $ hg push --to master

          
@@ 577,7 582,7 @@ Test that hooks are fired with the corre
   > prepushrebase = python "$RUNTESTDIR/printenv.py" prepushrebase
   > prepushkey = python "$RUNTESTDIR/printenv.py" prepushkey
   > [extensions]
-  > pushrebase = $TESTDIR/../pushrebase.py
+  > pushrebase =
   > EOF
   $ touch file && hg ci -Aqm initial
   pretxnclose hook: HG_PENDING=$TESTTMP/hookserver HG_PHASES_MOVED=1 HG_TXNID=TXN:* HG_TXNNAME=commit (glob)

          
@@ 595,7 600,7 @@ Test that hooks are fired with the corre
   $ cd hookclient
   $ cat >> .hg/hgrc <<EOF
   > [extensions]
-  > pushrebase = $TESTDIR/../pushrebase.py
+  > pushrebase =
   > EOF
   $ hg update master
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved

          
@@ 626,7 631,7 @@ Test date rewriting
   $ cd rewritedate
   $ cat >> .hg/hgrc <<EOF
   > [extensions]
-  > pushrebase = $TESTDIR/../pushrebase.py
+  > pushrebase =
   > [pushrebase]
   > rewritedates = True
   > EOF

          
@@ 641,7 646,7 @@ Test date rewriting
   $ cd rewritedateclient
   $ cat >> .hg/hgrc <<EOF
   > [extensions]
-  > pushrebase = $TESTDIR/../pushrebase.py
+  > pushrebase =
   > EOF
   $ hg up 0
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved

          
@@ 710,7 715,7 @@ Test force pushes
   $ cd forcepushserver
   $ cat >> .hg/hgrc <<EOF
   > [extensions]
-  > pushrebase = $TESTDIR/../pushrebase.py
+  > pushrebase =
   > EOF
   $ echo a > a && hg commit -Aqm a
   $ cd ..

          
@@ 724,7 729,7 @@ Test force pushes
   $ cd ../forcepushclient
   $ cat >> .hg/hgrc <<EOF
   > [extensions]
-  > pushrebase = $TESTDIR/../pushrebase.py
+  > pushrebase =
   > EOF
   $ hg up 0
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved