annotate tests/test-subrepo-svn @ 10273:e898bc7810ad

subrepo: handle svn externals and meta changes (issue1982) - Detect changes to meta on regular and external entries - Do not try to commit external entries
author Patrick Mezard <pmezard@gmail.com>
date Thu, 21 Jan 2010 13:26:26 +0100
parents 7e3a685be2f3
children caaa1f99d681
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 #!/bin/sh
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 "$TESTDIR/hghave" svn || exit 80
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4
10198
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
5 fix_path()
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
6 {
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
7 tr '\\' /
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
8 }
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
9
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
10 escapedwd=`pwd | fix_path`
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
11 # SVN wants all paths to start with a slash. Unfortunately,
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
12 # Windows ones don't. Handle that.
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
13 expr $escapedwd : "\/" > /dev/null
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
14 if [ $? -ne 0 ]; then
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
15 escapedwd='/'$escapedwd
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
16 fi
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
17 filterpath="sed s|$escapedwd|/root|"
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 echo % create subversion repo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21 SVNREPO="file://$escapedwd/svn-repo"
10267
7e3a685be2f3 test-subrepo-svn: remove bashism
Mads Kiilerich <mads@kiilerich.com>
parents: 10198
diff changeset
22 WCROOT="`pwd`/svn-wc"
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23 svnadmin create svn-repo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 svn co $SVNREPO svn-wc
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 cd svn-wc
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
26 mkdir src
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
27 echo alpha > src/alpha
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
28 svn add src
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
29 mkdir externals
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
30 echo other > externals/other
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
31 svn add externals
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
32 svn ci -m 'Add alpha'
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
33 svn up
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
34 cat > extdef <<EOF
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
35 externals -r1 $SVNREPO/externals
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
36 EOF
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
37 svn propset -F extdef svn:externals src
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
38 svn ci -m 'Setting externals'
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
39 cd ..
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
40
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
41 echo % create hg repo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
42 mkdir sub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
43 cd sub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
44 hg init t
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
45 cd t
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
46
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
47 echo % first revision, no sub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
48 echo a > a
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
49 hg ci -Am0
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
50
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
51 echo % add first svn sub
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
52 echo "s = [svn]$SVNREPO/src" >> .hgsub
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
53 svn co --quiet $SVNREPO/src s
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
54 hg add .hgsub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
55 hg ci -m1
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
56 echo % debugsub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
57 hg debugsub | $filterpath
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
58
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
59 echo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
60 echo % change file in svn and hg, commit
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
61 echo a >> a
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
62 echo alpha >> s/alpha
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
63 hg commit -m 'Message!'
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
64 hg debugsub | $filterpath
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
65
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
66 echo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
67 echo a > s/a
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
68 echo % should be empty despite change to s/a
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
69 hg st
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
70
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
71 echo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
72 echo % add a commit from svn
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
73 cd "$WCROOT"/src
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
74 svn up
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
75 echo xyz >> alpha
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
76 svn propset svn:mime-type 'text/xml' alpha
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
77 svn ci -m 'amend a from svn'
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
78 cd ../../sub/t
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
79
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
80 echo % this commit from hg will fail
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
81 echo zzz >> s/alpha
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
82 hg ci -m 'amend alpha from hg'
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
83 svn revert -q s/alpha
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
84
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
85 echo % this commit fails because of meta changes
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
86 svn propset svn:mime-type 'text/html' s/alpha
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
87 hg ci -m 'amend alpha from hg'
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
88 svn revert -q s/alpha
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
89
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
90 echo % this commit fails because of externals changes
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
91 echo zzz > s/externals/other
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
92 hg ci -m 'amend externals from hg'
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
93 svn revert -q s/externals/other
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
94
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
95 echo % this commit fails because of externals meta changes
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
96 svn propset svn:mime-type 'text/html' s/externals/other
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
97 hg ci -m 'amend externals from hg'
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
98 svn revert -q s/externals/other
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
99
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
100 echo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
101 echo % clone
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
102 cd ..
10198
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
103 hg clone t tc | fix_path
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
104 cd tc
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
105 echo % debugsub in clone
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
106 hg debugsub | $filterpath