Merge branch 'darcs' into master
[git-darcs-import.git] / tests / push-formerly-pl.sh
blob5527bc79b905f8fdb1970500c0cda00b62b80fe0
1 #!/usr/bin/env bash
2 set -ev
4 # Some tests for 'darcs push'
6 not () { "$@" && exit 1 || :; }
8 portable_pwd () {
9 if uname | grep -i cygwin > /dev/null; then
10 cygpath -w `pwd`
11 else
12 pwd
15 # setting IFS is an ugly hack for Cygwin
16 # so that the portable_pwd backtick
17 IFS=''
18 DIR=`portable_pwd`
20 rm -rf temp1 temp2
21 mkdir temp1
22 cd temp1
23 darcs init
24 cd ..
25 mkdir temp2
26 cd temp2
27 darcs init
28 cd ..
30 # push without a repo gives an error
31 cd temp1
32 not darcs push -p 123 2> log
33 grep -i 'missing argument' log
34 cd ..
36 mkdir -p temp2/one/two
37 cd temp2/one/two
38 # darcs push should work relative to the current directory
39 darcs push -a ../../../temp1 | grep -i 'No recorded local changes to push'
40 cd ../../../
42 # darcs push should push into repo specified with --repo
43 cd temp2
44 darcs add one
45 darcs record --patch-name uno --all
46 cd ..
48 darcs push --repodir temp2 --all temp1 | grep -i 'Finished apply'
50 cd temp1
51 # Before trying to pull from self, defaultrepo does not exist
52 test ! -e _darcs/prefs/defaultrepo
53 # return special message when you try to push to yourself
54 not darcs push -a ${DIR}/temp1 2> log
55 grep -i "can't push to current repository!" log
56 # and don't update the default repo to be the current dir
57 test ! -e _darcs/prefs/defaultrepo
58 cd ..
60 rm -rf temp1 temp2