annotate tests/test-subrepo-svn @ 10267:7e3a685be2f3

test-subrepo-svn: remove bashism
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 17 Jan 2010 01:53:04 +0100
parents c2168d170f05
children e898bc7810ad
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
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26 echo alpha > alpha
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27 svn add alpha
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28 svn ci -m 'Add alpha'
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
29 cd ..
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
30
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
31 echo % create hg repo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
32 mkdir sub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
33 cd sub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
34 hg init t
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
35 cd t
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
36
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
37 echo % first revision, no sub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
38 echo a > a
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
39 hg ci -Am0
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 % add first svn sub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
42 echo "s = [svn]$SVNREPO" >> .hgsub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
43 svn co --quiet $SVNREPO s
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
44 hg add .hgsub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
45 hg ci -m1
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
46 echo % debugsub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
47 hg debugsub | $filterpath
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
48
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
49 echo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
50 echo % change file in svn and hg, commit
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
51 echo a >> a
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
52 echo alpha >> s/alpha
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
53 hg commit -m 'Message!'
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
54 hg debugsub | $filterpath
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
55
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
56 echo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
57 echo a > s/a
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
58 echo % should be empty despite change to s/a
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
59 hg st
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
60
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
61 echo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
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
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
64 svn up
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
65 echo xyz >> alpha
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
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
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
68 echo % this commit from hg will fail
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
69 echo zzz >> s/alpha
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
70 hg ci -m 'amend alpha from hg'
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
71
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
72 echo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
73 echo % clone
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
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
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
76 cd tc
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
77 echo % debugsub in clone
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
78 hg debugsub | $filterpath