Show More
@@ -1,113 +1,193 b'' | |||||
1 | #!/bin/sh |
|
1 | $ "$TESTDIR/hghave" svn || exit 80 | |
2 |
|
||||
3 | "$TESTDIR/hghave" svn || exit 80 |
|
|||
4 |
|
2 | |||
5 | fix_path() |
|
3 | $ fix_path() | |
6 | { |
|
4 | > { | |
7 | tr '\\' / |
|
5 | > tr '\\' / | |
8 | } |
|
6 | > } | |
|
7 | ||||
|
8 | $ escapedwd=`pwd | fix_path` | |||
9 |
|
9 | |||
10 | escapedwd=`pwd | fix_path` |
|
10 | SVN wants all paths to start with a slash. Unfortunately, Windows ones | |
11 | # SVN wants all paths to start with a slash. Unfortunately, |
|
11 | don't. Handle that. | |
12 | # Windows ones don't. Handle that. |
|
|||
13 | expr "$escapedwd" : "\/" > /dev/null |
|
|||
14 | if [ $? -ne 0 ]; then |
|
|||
15 | escapedwd="/$escapedwd" |
|
|||
16 | fi |
|
|||
17 | escapedwd=`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$escapedwd"` |
|
|||
18 | filterpath="s|$escapedwd|/root|" |
|
|||
19 | filteroutofdate='s/ in transaction.*/ is out of date/;s/Out of date: /File /' |
|
|||
20 | filterexternal="s|Fetching external item into '.*/s/externals'|Fetching external item into 's/externals'|g" |
|
|||
21 |
|
12 | |||
22 | echo % create subversion repo |
|
13 | $ expr "$escapedwd" : "\/" > /dev/null | |
|
14 | $ if [ $? -ne 0 ]; then | |||
|
15 | > escapedwd="/$escapedwd" | |||
|
16 | > fi | |||
|
17 | $ escapedwd=`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$escapedwd"` | |||
|
18 | $ filterpath="s|$escapedwd|/root|" | |||
|
19 | $ filteroutofdate='s/ in transaction.*/ is out of date/;s/Out of date: /File /' | |||
|
20 | ||||
|
21 | create subversion repo | |||
23 |
|
22 | |||
24 | SVNREPO="file://$escapedwd/svn-repo" |
|
23 | $ SVNREPO="file://$escapedwd/svn-repo" | |
25 | WCROOT="`pwd`/svn-wc" |
|
24 | $ WCROOT="`pwd`/svn-wc" | |
26 | svnadmin create svn-repo |
|
25 | $ svnadmin create svn-repo | |
27 | svn co "$SVNREPO" svn-wc |
|
26 | $ svn co "$SVNREPO" svn-wc | |
28 | cd svn-wc |
|
27 | Checked out revision 0. | |
29 | mkdir src |
|
28 | $ cd svn-wc | |
30 | echo alpha > src/alpha |
|
29 | $ mkdir src | |
31 | svn add src |
|
30 | $ echo alpha > src/alpha | |
32 | mkdir externals |
|
31 | $ svn add src | |
33 | echo other > externals/other |
|
32 | A src | |
34 | svn add externals |
|
33 | A src/alpha | |
35 | svn ci -m 'Add alpha' |
|
34 | $ mkdir externals | |
36 | svn up |
|
35 | $ echo other > externals/other | |
37 | cat > extdef <<EOF |
|
36 | $ svn add externals | |
38 | externals -r1 $SVNREPO/externals |
|
37 | A externals | |
39 | EOF |
|
38 | A externals/other | |
40 | svn propset -F extdef svn:externals src |
|
39 | $ svn ci -m 'Add alpha' | |
41 | svn ci -m 'Setting externals' |
|
40 | Adding externals | |
42 | cd .. |
|
41 | Adding externals/other | |
|
42 | Adding src | |||
|
43 | Adding src/alpha | |||
|
44 | Transmitting file data .. | |||
|
45 | Committed revision 1. | |||
|
46 | $ svn up | |||
|
47 | At revision 1. | |||
|
48 | $ echo "externals -r1 $SVNREPO/externals" > extdef | |||
|
49 | $ svn propset -F extdef svn:externals src | |||
|
50 | property 'svn:externals' set on 'src' | |||
|
51 | $ svn ci -m 'Setting externals' | |||
|
52 | Sending src | |||
|
53 | ||||
|
54 | Committed revision 2. | |||
|
55 | $ cd .. | |||
|
56 | ||||
|
57 | create hg repo | |||
43 |
|
58 | |||
44 | echo % create hg repo |
|
59 | $ mkdir sub | |
45 | mkdir sub |
|
60 | $ cd sub | |
46 | cd sub |
|
61 | $ hg init t | |
47 | hg init t |
|
62 | $ cd t | |
48 | cd t |
|
63 | ||
|
64 | first revision, no sub | |||
|
65 | ||||
|
66 | $ echo a > a | |||
|
67 | $ hg ci -Am0 | |||
|
68 | adding a | |||
|
69 | ||||
|
70 | add first svn sub with leading whitespaces | |||
49 |
|
71 | |||
50 | echo % first revision, no sub |
|
72 | $ echo "s = [svn] $SVNREPO/src" >> .hgsub | |
51 | echo a > a |
|
73 | $ svn co --quiet "$SVNREPO"/src s | |
52 | hg ci -Am0 |
|
74 | $ hg add .hgsub | |
|
75 | $ hg ci -m1 | |||
|
76 | committing subrepository s | |||
|
77 | ||||
|
78 | debugsub | |||
|
79 | ||||
|
80 | $ hg debugsub | sed "$filterpath" | |||
|
81 | path s | |||
|
82 | source file:///root/svn-repo/src | |||
|
83 | revision 2 | |||
|
84 | ||||
|
85 | change file in svn and hg, commit | |||
|
86 | ||||
|
87 | $ echo a >> a | |||
|
88 | $ echo alpha >> s/alpha | |||
|
89 | $ hg commit -m 'Message!' \ | |||
|
90 | > | sed 's:Sending.*s/alpha:Sending s/alpha:g' | |||
|
91 | committing subrepository s | |||
|
92 | Sending s/alpha | |||
|
93 | Transmitting file data . | |||
|
94 | Committed revision 3. | |||
53 |
|
95 | |||
54 | echo % add first svn sub with leading whitespaces |
|
96 | Fetching external item into '.*/s/externals' | |
55 | echo "s = [svn] $SVNREPO/src" >> .hgsub |
|
97 | External at revision 1. | |
56 | svn co --quiet "$SVNREPO"/src s |
|
98 | ||
57 | hg add .hgsub |
|
99 | At revision 3. | |
58 | hg ci -m1 |
|
100 | $ hg debugsub | sed "$filterpath" | |
59 | echo % debugsub |
|
101 | path s | |
60 | hg debugsub | sed "$filterpath" |
|
102 | source file:///root/svn-repo/src | |
|
103 | revision 3 | |||
|
104 | ||||
|
105 | $ echo a > s/a | |||
|
106 | ||||
|
107 | should be empty despite change to s/a | |||
|
108 | ||||
|
109 | $ hg st | |||
|
110 | ||||
|
111 | add a commit from svn | |||
|
112 | ||||
|
113 | $ cd "$WCROOT"/src | |||
|
114 | $ svn up | |||
|
115 | U alpha | |||
61 |
|
116 | |||
62 | echo |
|
117 | Fetching external item into 'externals' | |
63 | echo % change file in svn and hg, commit |
|
118 | A externals/other | |
64 | echo a >> a |
|
119 | Updated external to revision 1. | |
65 | echo alpha >> s/alpha |
|
|||
66 | hg commit -m 'Message!' | sed "$filterexternal" \ |
|
|||
67 | | sed 's:Sending.*s/alpha:Sending s/alpha:g' |
|
|||
68 | hg debugsub | sed "$filterpath" |
|
|||
69 |
|
120 | |||
70 | echo |
|
121 | Updated to revision 3. | |
71 | echo a > s/a |
|
122 | $ echo xyz >> alpha | |
72 | echo % should be empty despite change to s/a |
|
123 | $ svn propset svn:mime-type 'text/xml' alpha | |
73 | hg st |
|
124 | property 'svn:mime-type' set on 'alpha' | |
|
125 | $ svn ci -m 'amend a from svn' | |||
|
126 | Sending src/alpha | |||
|
127 | Transmitting file data . | |||
|
128 | Committed revision 4. | |||
|
129 | $ cd ../../sub/t | |||
74 |
|
130 | |||
75 | echo |
|
131 | this commit from hg will fail | |
76 | echo % add a commit from svn |
|
132 | ||
77 | cd "$WCROOT"/src |
|
133 | $ echo zzz >> s/alpha | |
78 | svn up |
|
134 | $ hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate" | |
79 | echo xyz >> alpha |
|
135 | committing subrepository s | |
80 | svn propset svn:mime-type 'text/xml' alpha |
|
136 | abort: svn: Commit failed (details follow): | |
81 | svn ci -m 'amend a from svn' |
|
137 | svn: File '/src/alpha' is out of date | |
82 | cd ../../sub/t |
|
138 | $ svn revert -q s/alpha | |
|
139 | ||||
|
140 | this commit fails because of meta changes | |||
83 |
|
141 | |||
84 | echo % this commit from hg will fail |
|
142 | $ svn propset svn:mime-type 'text/html' s/alpha | |
85 | echo zzz >> s/alpha |
|
143 | property 'svn:mime-type' set on 's/alpha' | |
86 | hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate" |
|
144 | $ hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate" | |
87 | svn revert -q s/alpha |
|
145 | committing subrepository s | |
|
146 | abort: svn: Commit failed (details follow): | |||
|
147 | svn: File '/src/alpha' is out of date | |||
|
148 | $ svn revert -q s/alpha | |||
|
149 | ||||
|
150 | this commit fails because of externals changes | |||
88 |
|
151 | |||
89 | echo % this commit fails because of meta changes |
|
152 | $ echo zzz > s/externals/other | |
90 | svn propset svn:mime-type 'text/html' s/alpha |
|
153 | $ hg ci -m 'amend externals from hg' | |
91 | hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate" |
|
154 | committing subrepository s | |
92 | svn revert -q s/alpha |
|
155 | abort: cannot commit svn externals | |
|
156 | $ svn revert -q s/externals/other | |||
93 |
|
157 | |||
94 |
|
|
158 | this commit fails because of externals meta changes | |
95 | echo zzz > s/externals/other |
|
159 | ||
96 | hg ci -m 'amend externals from hg' |
|
160 | $ svn propset svn:mime-type 'text/html' s/externals/other | |
97 | svn revert -q s/externals/other |
|
161 | property 'svn:mime-type' set on 's/externals/other' | |
|
162 | $ hg ci -m 'amend externals from hg' | |||
|
163 | committing subrepository s | |||
|
164 | abort: cannot commit svn externals | |||
|
165 | $ svn revert -q s/externals/other | |||
98 |
|
166 | |||
99 | echo % this commit fails because of externals meta changes |
|
167 | clone | |
100 | svn propset svn:mime-type 'text/html' s/externals/other |
|
168 | ||
101 | hg ci -m 'amend externals from hg' |
|
169 | $ cd .. | |
102 | svn revert -q s/externals/other |
|
170 | $ hg clone t tc | fix_path | |
|
171 | updating to branch default | |||
|
172 | A tc/s/alpha | |||
|
173 | U tc/s | |||
|
174 | ||||
|
175 | Fetching external item into 'tc/s/externals' | |||
|
176 | A tc/s/externals/other | |||
|
177 | Checked out external at revision 1. | |||
103 |
|
178 | |||
104 | echo |
|
179 | Checked out revision 3. | |
105 | echo % clone |
|
180 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
106 | cd .. |
|
181 | $ cd tc | |
107 | hg clone t tc | fix_path |
|
182 | ||
108 | cd tc |
|
183 | debugsub in clone | |
109 | echo % debugsub in clone |
|
|||
110 | hg debugsub | sed "$filterpath" |
|
|||
111 |
|
184 | |||
112 | echo % verify subrepo is contained within the repo directory |
|
185 | $ hg debugsub | sed "$filterpath" | |
113 | python -c "import os.path; print os.path.exists('s')" |
|
186 | path s | |
|
187 | source file:///root/svn-repo/src | |||
|
188 | revision 3 | |||
|
189 | ||||
|
190 | verify subrepo is contained within the repo directory | |||
|
191 | ||||
|
192 | $ python -c "import os.path; print os.path.exists('s')" | |||
|
193 | True |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now