##// END OF EJS Templates
test-subrepo-svn: handle svn output changes gracefully
Augie Fackler -
r10423:caaa1f99 default
parent child Browse files
Show More
@@ -1,106 +1,107
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" svn || exit 80
3 "$TESTDIR/hghave" svn || exit 80
4
4
5 fix_path()
5 fix_path()
6 {
6 {
7 tr '\\' /
7 tr '\\' /
8 }
8 }
9
9
10 escapedwd=`pwd | fix_path`
10 escapedwd=`pwd | fix_path`
11 # SVN wants all paths to start with a slash. Unfortunately,
11 # SVN wants all paths to start with a slash. Unfortunately,
12 # Windows ones don't. Handle that.
12 # Windows ones don't. Handle that.
13 expr $escapedwd : "\/" > /dev/null
13 expr $escapedwd : "\/" > /dev/null
14 if [ $? -ne 0 ]; then
14 if [ $? -ne 0 ]; then
15 escapedwd='/'$escapedwd
15 escapedwd='/'$escapedwd
16 fi
16 fi
17 filterpath="sed s|$escapedwd|/root|"
17 filterpath="sed s|$escapedwd|/root|"
18 filtersvn='s/ in transaction.*/ is out of date/;s/Out of date: /File /'
18
19
19 echo % create subversion repo
20 echo % create subversion repo
20
21
21 SVNREPO="file://$escapedwd/svn-repo"
22 SVNREPO="file://$escapedwd/svn-repo"
22 WCROOT="`pwd`/svn-wc"
23 WCROOT="`pwd`/svn-wc"
23 svnadmin create svn-repo
24 svnadmin create svn-repo
24 svn co $SVNREPO svn-wc
25 svn co $SVNREPO svn-wc
25 cd svn-wc
26 cd svn-wc
26 mkdir src
27 mkdir src
27 echo alpha > src/alpha
28 echo alpha > src/alpha
28 svn add src
29 svn add src
29 mkdir externals
30 mkdir externals
30 echo other > externals/other
31 echo other > externals/other
31 svn add externals
32 svn add externals
32 svn ci -m 'Add alpha'
33 svn ci -m 'Add alpha'
33 svn up
34 svn up
34 cat > extdef <<EOF
35 cat > extdef <<EOF
35 externals -r1 $SVNREPO/externals
36 externals -r1 $SVNREPO/externals
36 EOF
37 EOF
37 svn propset -F extdef svn:externals src
38 svn propset -F extdef svn:externals src
38 svn ci -m 'Setting externals'
39 svn ci -m 'Setting externals'
39 cd ..
40 cd ..
40
41
41 echo % create hg repo
42 echo % create hg repo
42 mkdir sub
43 mkdir sub
43 cd sub
44 cd sub
44 hg init t
45 hg init t
45 cd t
46 cd t
46
47
47 echo % first revision, no sub
48 echo % first revision, no sub
48 echo a > a
49 echo a > a
49 hg ci -Am0
50 hg ci -Am0
50
51
51 echo % add first svn sub
52 echo % add first svn sub
52 echo "s = [svn]$SVNREPO/src" >> .hgsub
53 echo "s = [svn]$SVNREPO/src" >> .hgsub
53 svn co --quiet $SVNREPO/src s
54 svn co --quiet $SVNREPO/src s
54 hg add .hgsub
55 hg add .hgsub
55 hg ci -m1
56 hg ci -m1
56 echo % debugsub
57 echo % debugsub
57 hg debugsub | $filterpath
58 hg debugsub | $filterpath
58
59
59 echo
60 echo
60 echo % change file in svn and hg, commit
61 echo % change file in svn and hg, commit
61 echo a >> a
62 echo a >> a
62 echo alpha >> s/alpha
63 echo alpha >> s/alpha
63 hg commit -m 'Message!'
64 hg commit -m 'Message!'
64 hg debugsub | $filterpath
65 hg debugsub | $filterpath
65
66
66 echo
67 echo
67 echo a > s/a
68 echo a > s/a
68 echo % should be empty despite change to s/a
69 echo % should be empty despite change to s/a
69 hg st
70 hg st
70
71
71 echo
72 echo
72 echo % add a commit from svn
73 echo % add a commit from svn
73 cd "$WCROOT"/src
74 cd "$WCROOT"/src
74 svn up
75 svn up
75 echo xyz >> alpha
76 echo xyz >> alpha
76 svn propset svn:mime-type 'text/xml' alpha
77 svn propset svn:mime-type 'text/xml' alpha
77 svn ci -m 'amend a from svn'
78 svn ci -m 'amend a from svn'
78 cd ../../sub/t
79 cd ../../sub/t
79
80
80 echo % this commit from hg will fail
81 echo % this commit from hg will fail
81 echo zzz >> s/alpha
82 echo zzz >> s/alpha
82 hg ci -m 'amend alpha from hg'
83 hg ci -m 'amend alpha from hg' 2>&1 | sed "$filtersvn"
83 svn revert -q s/alpha
84 svn revert -q s/alpha
84
85
85 echo % this commit fails because of meta changes
86 echo % this commit fails because of meta changes
86 svn propset svn:mime-type 'text/html' s/alpha
87 svn propset svn:mime-type 'text/html' s/alpha
87 hg ci -m 'amend alpha from hg'
88 hg ci -m 'amend alpha from hg' 2>&1 | sed "$filtersvn"
88 svn revert -q s/alpha
89 svn revert -q s/alpha
89
90
90 echo % this commit fails because of externals changes
91 echo % this commit fails because of externals changes
91 echo zzz > s/externals/other
92 echo zzz > s/externals/other
92 hg ci -m 'amend externals from hg'
93 hg ci -m 'amend externals from hg'
93 svn revert -q s/externals/other
94 svn revert -q s/externals/other
94
95
95 echo % this commit fails because of externals meta changes
96 echo % this commit fails because of externals meta changes
96 svn propset svn:mime-type 'text/html' s/externals/other
97 svn propset svn:mime-type 'text/html' s/externals/other
97 hg ci -m 'amend externals from hg'
98 hg ci -m 'amend externals from hg'
98 svn revert -q s/externals/other
99 svn revert -q s/externals/other
99
100
100 echo
101 echo
101 echo % clone
102 echo % clone
102 cd ..
103 cd ..
103 hg clone t tc | fix_path
104 hg clone t tc | fix_path
104 cd tc
105 cd tc
105 echo % debugsub in clone
106 echo % debugsub in clone
106 hg debugsub | $filterpath
107 hg debugsub | $filterpath
General Comments 0
You need to be logged in to leave comments. Login now