author | Matt Mackall <mpm@selenic.com> |
Mon, 01 Feb 2010 11:34:44 -0600 | |
changeset 10312 | 131a012aa878 |
parent 10273 | e898bc7810ad |
child 10423 | caaa1f99d681 |
permissions | -rwxr-xr-x |
10178 | 1 |
#!/bin/sh |
2 |
||
3 |
"$TESTDIR/hghave" svn || exit 80 |
|
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 | 18 |
|
19 |
echo % create subversion repo |
|
20 |
||
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 | 23 |
svnadmin create svn-repo |
24 |
svn co $SVNREPO svn-wc |
|
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 | 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 | 39 |
cd .. |
40 |
||
41 |
echo % create hg repo |
|
42 |
mkdir sub |
|
43 |
cd sub |
|
44 |
hg init t |
|
45 |
cd t |
|
46 |
||
47 |
echo % first revision, no sub |
|
48 |
echo a > a |
|
49 |
hg ci -Am0 |
|
50 |
||
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 | 54 |
hg add .hgsub |
55 |
hg ci -m1 |
|
56 |
echo % debugsub |
|
57 |
hg debugsub | $filterpath |
|
58 |
||
59 |
echo |
|
60 |
echo % change file in svn and hg, commit |
|
61 |
echo a >> a |
|
62 |
echo alpha >> s/alpha |
|
63 |
hg commit -m 'Message!' |
|
64 |
hg debugsub | $filterpath |
|
65 |
||
66 |
echo |
|
67 |
echo a > s/a |
|
68 |
echo % should be empty despite change to s/a |
|
69 |
hg st |
|
70 |
||
71 |
echo |
|
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 | 74 |
svn up |
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 | 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 | 80 |
echo % this commit from hg will fail |
81 |
echo zzz >> s/alpha |
|
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 | 99 |
|
100 |
echo |
|
101 |
echo % clone |
|
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 | 104 |
cd tc |
105 |
echo % debugsub in clone |
|
106 |
hg debugsub | $filterpath |