author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
Wed, 13 Jan 2010 12:00:06 +0100 | |
changeset 10244 | c4c0502be198 |
parent 10198 | c2168d170f05 |
child 10267 | 7e3a685be2f3 |
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" |
|
22 |
WCROOT="$(pwd)/svn-wc" |
|
23 |
svnadmin create svn-repo |
|
24 |
svn co $SVNREPO svn-wc |
|
25 |
cd svn-wc |
|
26 |
echo alpha > alpha |
|
27 |
svn add alpha |
|
28 |
svn ci -m 'Add alpha' |
|
29 |
cd .. |
|
30 |
||
31 |
echo % create hg repo |
|
32 |
mkdir sub |
|
33 |
cd sub |
|
34 |
hg init t |
|
35 |
cd t |
|
36 |
||
37 |
echo % first revision, no sub |
|
38 |
echo a > a |
|
39 |
hg ci -Am0 |
|
40 |
||
41 |
echo % add first svn sub |
|
42 |
echo "s = [svn]$SVNREPO" >> .hgsub |
|
43 |
svn co --quiet $SVNREPO s |
|
44 |
hg add .hgsub |
|
45 |
hg ci -m1 |
|
46 |
echo % debugsub |
|
47 |
hg debugsub | $filterpath |
|
48 |
||
49 |
echo |
|
50 |
echo % change file in svn and hg, commit |
|
51 |
echo a >> a |
|
52 |
echo alpha >> s/alpha |
|
53 |
hg commit -m 'Message!' |
|
54 |
hg debugsub | $filterpath |
|
55 |
||
56 |
echo |
|
57 |
echo a > s/a |
|
58 |
echo % should be empty despite change to s/a |
|
59 |
hg st |
|
60 |
||
61 |
echo |
|
62 |
echo % add a commit from svn |
|
10196
20d849251fe6
test-subrepo-svn: avoid pushd/popd
Patrick Mezard <pmezard@gmail.com>
parents:
10178
diff
changeset
|
63 |
cd "$WCROOT" |
10178 | 64 |
svn up |
65 |
echo xyz >> alpha |
|
66 |
svn ci -m 'amend a from svn' |
|
10196
20d849251fe6
test-subrepo-svn: avoid pushd/popd
Patrick Mezard <pmezard@gmail.com>
parents:
10178
diff
changeset
|
67 |
cd ../sub/t |
10178 | 68 |
echo % this commit from hg will fail |
69 |
echo zzz >> s/alpha |
|
70 |
hg ci -m 'amend alpha from hg' |
|
71 |
||
72 |
echo |
|
73 |
echo % clone |
|
74 |
cd .. |
|
10198
c2168d170f05
test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents:
10196
diff
changeset
|
75 |
hg clone t tc | fix_path |
10178 | 76 |
cd tc |
77 |
echo % debugsub in clone |
|
78 |
hg debugsub | $filterpath |