comparison tests/test-convert-hg-svn @ 10775:c52057614c72 stable

Tests with spaces in paths This allows most tests to succeed with ./run-tests.py --tmpdir='/tmp/hg test' and introduces other tests for spaces and shell quoting
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 24 Mar 2010 01:43:24 +0100
parents a02d43acbc04
children
comparison
equal deleted inserted replaced
10772:1e819576e926 10775:c52057614c72
10 echo "[extensions]" >> $HGRCPATH 10 echo "[extensions]" >> $HGRCPATH
11 echo "convert = " >> $HGRCPATH 11 echo "convert = " >> $HGRCPATH
12 echo "mq = " >> $HGRCPATH 12 echo "mq = " >> $HGRCPATH
13 13
14 svnpath=`pwd | fix_path`/svn-repo 14 svnpath=`pwd | fix_path`/svn-repo
15 svnadmin create $svnpath 15 svnadmin create "$svnpath"
16 16
17 cat > $svnpath/hooks/pre-revprop-change <<'EOF' 17 cat > "$svnpath"/hooks/pre-revprop-change <<'EOF'
18 #!/bin/sh 18 #!/bin/sh
19 19
20 REPOS="$1" 20 REPOS="$1"
21 REV="$2" 21 REV="$2"
22 USER="$3" 22 USER="$3"
28 if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi 28 if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi
29 29
30 echo "Changing prohibited revision property" >&2 30 echo "Changing prohibited revision property" >&2
31 exit 1 31 exit 1
32 EOF 32 EOF
33 chmod +x $svnpath/hooks/pre-revprop-change 33 chmod +x "$svnpath"/hooks/pre-revprop-change
34 34
35 # SVN wants all paths to start with a slash. Unfortunately, 35 # SVN wants all paths to start with a slash. Unfortunately,
36 # Windows ones don't. Handle that. 36 # Windows ones don't. Handle that.
37 svnurl=$svnpath 37 svnurl="$svnpath"
38 expr $svnurl : "\/" > /dev/null 38 expr "$svnurl" : "\/" > /dev/null
39 if [ $? -ne 0 ]; then 39 if [ $? -ne 0 ]; then
40 svnurl='/'$svnurl 40 svnurl="/$svnurl"
41 fi 41 fi
42 svnurl=file://$svnurl 42 svnurl="file://$svnurl"
43 svn co $svnurl $svnpath-wc 43 svn co "$svnurl" "$svnpath"-wc
44 44
45 cd $svnpath-wc 45 cd "$svnpath"-wc
46 echo a > a 46 echo a > a
47 svn add a 47 svn add a
48 svn ci -m'added a' a 48 svn ci -m'added a' a
49 49
50 cd .. 50 cd ..
51 51
52 echo % initial roundtrip 52 echo % initial roundtrip
53 hg convert -s svn -d hg $svnpath-wc $svnpath-hg | grep -v initializing 53 hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg | grep -v initializing
54 hg convert -s hg -d svn $svnpath-hg $svnpath-wc 54 hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc
55 55
56 echo % second roundtrip should do nothing 56 echo % second roundtrip should do nothing
57 hg convert -s svn -d hg $svnpath-wc $svnpath-hg 57 hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg
58 hg convert -s hg -d svn $svnpath-hg $svnpath-wc 58 hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc
59 59
60 echo % new hg rev 60 echo % new hg rev
61 61
62 hg clone $svnpath-hg $svnpath-work 62 hg clone "$svnpath"-hg "$svnpath"-work
63 cd $svnpath-work 63 cd "$svnpath"-work
64 echo b > b 64 echo b > b
65 hg add b 65 hg add b
66 hg ci -mb 66 hg ci -mb
67 echo '% adding an empty revision' 67 echo '% adding an empty revision'
68 hg qnew -m emtpy empty 68 hg qnew -m emtpy empty
69 hg qfinish -a 69 hg qfinish -a
70 cd .. 70 cd ..
71 71
72 echo % echo hg to svn 72 echo % echo hg to svn
73 hg --cwd $svnpath-hg pull -q $svnpath-work 73 hg --cwd "$svnpath"-hg pull -q "$svnpath"-work
74 hg convert -s hg -d svn $svnpath-hg $svnpath-wc 74 hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc
75 75
76 echo % svn back to hg should do nothing 76 echo % svn back to hg should do nothing
77 hg convert -s svn -d hg $svnpath-wc $svnpath-hg 77 hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg
78 echo % hg back to svn should do nothing 78 echo % hg back to svn should do nothing
79 hg convert -s hg -d svn $svnpath-hg $svnpath-wc 79 hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc