##// END OF EJS Templates
test-convert-hg-svn: make it more windows friendly
Patrick Mezard -
r5809:34c4131a default
parent child Browse files
Show More
@@ -1,66 +1,73
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" svn svn-bindings || exit 80
3 "$TESTDIR/hghave" svn svn-bindings || exit 80
4
4
5 fix_path()
5 fix_path()
6 {
6 {
7 tr '\\' /
7 tr '\\' /
8 }
8 }
9
9
10 echo "[extensions]" >> $HGRCPATH
10 echo "[extensions]" >> $HGRCPATH
11 echo "convert = " >> $HGRCPATH
11 echo "convert = " >> $HGRCPATH
12
12
13 svnpath=`pwd`/svn-repo
13 svnpath=`pwd | fix_path`/svn-repo
14 svnadmin create $svnpath
14 svnadmin create $svnpath
15
15
16 cat > $svnpath/hooks/pre-revprop-change <<'EOF'
16 cat > $svnpath/hooks/pre-revprop-change <<'EOF'
17 #!/bin/sh
17 #!/bin/sh
18
18
19 REPOS="$1"
19 REPOS="$1"
20 REV="$2"
20 REV="$2"
21 USER="$3"
21 USER="$3"
22 PROPNAME="$4"
22 PROPNAME="$4"
23 ACTION="$5"
23 ACTION="$5"
24
24
25 if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
25 if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
26 if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi
26 if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi
27 if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi
27 if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi
28
28
29 echo "Changing prohibited revision property" >&2
29 echo "Changing prohibited revision property" >&2
30 exit 1
30 exit 1
31 EOF
31 EOF
32 chmod +x $svnpath/hooks/pre-revprop-change
32 chmod +x $svnpath/hooks/pre-revprop-change
33
33
34 svnurl=file://$svnpath
34 # SVN wants all paths to start with a slash. Unfortunately,
35 # Windows ones don't. Handle that.
36 svnurl=$svnpath
37 expr $svnurl : "\/" > /dev/null
38 if [ $? -ne 0 ]; then
39 svnurl='/'$svnurl
40 fi
41 svnurl=file://$svnurl
35 svn co $svnurl $svnpath-wc
42 svn co $svnurl $svnpath-wc
36
43
37 cd $svnpath-wc
44 cd $svnpath-wc
38 echo a > a
45 echo a > a
39 svn add a
46 svn add a
40 svn ci -m'added a' a
47 svn ci -m'added a' a
41
48
42 cd ..
49 cd ..
43
50
44 echo % initial roundtrip
51 echo % initial roundtrip
45 hg convert -s svn -d hg $svnpath-wc $svnpath-hg | grep -v initializing
52 hg convert -s svn -d hg $svnpath-wc $svnpath-hg | grep -v initializing
46 hg convert -s hg -d svn $svnpath-hg $svnpath-wc
53 hg convert -s hg -d svn $svnpath-hg $svnpath-wc
47
54
48 echo % second roundtrip should do nothing
55 echo % second roundtrip should do nothing
49 hg convert -s svn -d hg $svnpath-wc $svnpath-hg
56 hg convert -s svn -d hg $svnpath-wc $svnpath-hg
50 hg convert -s hg -d svn $svnpath-hg $svnpath-wc
57 hg convert -s hg -d svn $svnpath-hg $svnpath-wc
51
58
52 echo % new hg rev
59 echo % new hg rev
53
60
54 hg clone $svnpath-hg $svnpath-work
61 hg clone $svnpath-hg $svnpath-work
55 echo b > $svnpath-work/b
62 echo b > $svnpath-work/b
56 hg --cwd $svnpath-work add b
63 hg --cwd $svnpath-work add b
57 hg --cwd $svnpath-work ci -mb
64 hg --cwd $svnpath-work ci -mb
58
65
59 echo % echo hg to svn
66 echo % echo hg to svn
60 hg --cwd $svnpath-hg pull -q $svnpath-work
67 hg --cwd $svnpath-hg pull -q $svnpath-work
61 hg convert -s hg -d svn $svnpath-hg $svnpath-wc
68 hg convert -s hg -d svn $svnpath-hg $svnpath-wc
62
69
63 echo % svn back to hg should do nothing
70 echo % svn back to hg should do nothing
64 hg convert -s svn -d hg $svnpath-wc $svnpath-hg
71 hg convert -s svn -d hg $svnpath-wc $svnpath-hg
65 echo % hg back to svn should do nothing
72 echo % hg back to svn should do nothing
66 hg convert -s hg -d svn $svnpath-hg $svnpath-wc
73 hg convert -s hg -d svn $svnpath-hg $svnpath-wc
General Comments 0
You need to be logged in to leave comments. Login now