exchange: have a function doing all the common initial setup
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 03 Mar 2014 13:27:53 -0800
changeset 830 f3b3a09ba312
parent 829 0943f327e2fb
child 831 a6af6919888d
exchange: have a function doing all the common initial setup This will help creation of further test.
tests/_exc-util.sh
tests/test-exchange-A2.t
--- a/tests/_exc-util.sh	Mon Mar 03 13:12:50 2014 -0800
+++ b/tests/_exc-util.sh	Mon Mar 03 13:27:53 2014 -0800
@@ -21,3 +21,20 @@
 getid() {
    hg id --hidden --debug -ir "$1"
 }
+
+setuprepos() {
+    echo creating test repo for test case $1
+    mkdir $1
+    cd $1
+    echo - pulldest
+    hg init pushdest
+    cd pushdest
+    mkcommit O
+    hg phase --public .
+    cd ..
+    echo - main
+    hg clone -q pushdest main
+    echo - pushdest
+    hg clone -q main pulldest
+    echo 'cd into `main` and proceed with env setup'
+}
--- a/tests/test-exchange-A2.t	Mon Mar 03 13:12:50 2014 -0800
+++ b/tests/test-exchange-A2.t	Mon Mar 03 13:27:53 2014 -0800
@@ -33,16 +33,13 @@
 
 initial
 
-  $ mkdir A.2
-  $ cd A.2
-  $ hg init main
-  $ hg init pushdest
-  $ hg init pulldest
+  $ setuprepos A.2
+  creating test repo for test case A.2
+  - pulldest
+  - main
+  - pushdest
+  cd into `main` and proceed with env setup
   $ cd main
-  $ mkcommit O
-  $ hg phase --public .
-  $ hg push -q ../pushdest
-  $ hg push -q ../pulldest
   $ mkcommit A
   $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A)'`
   $ hg up .^