##// END OF EJS Templates
tests: make tests for convert with svn portable...
FUJIWARA Katsunori -
r28533:dfd5a683 default
parent child Browse files
Show More
@@ -1,122 +1,122
1 #require svn svn-bindings
1 #require svn svn-bindings
2
2
3 $ filter_svn_output () {
3 $ filter_svn_output () {
4 > egrep -v 'Committing|Updating' | sed -e 's/done$//' || true
4 > egrep -v 'Committing|Updating|(^$)' | sed -e 's/done$//' || true
5 > }
5 > }
6
6
7 $ cat <<EOF >> $HGRCPATH
7 $ cat <<EOF >> $HGRCPATH
8 > [extensions]
8 > [extensions]
9 > convert =
9 > convert =
10 > mq =
10 > mq =
11 > EOF
11 > EOF
12
12
13 $ SVNREPOPATH=`pwd`/svn-repo
13 $ SVNREPOPATH=`pwd`/svn-repo
14 #if windows
14 #if windows
15 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
15 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
16 #else
16 #else
17 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
17 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
18 #endif
18 #endif
19
19
20 $ svnadmin create "$SVNREPOPATH"
20 $ svnadmin create "$SVNREPOPATH"
21 $ cat > "$SVNREPOPATH"/hooks/pre-revprop-change <<EOF
21 $ cat > "$SVNREPOPATH"/hooks/pre-revprop-change <<EOF
22 > #!/bin/sh
22 > #!/bin/sh
23 >
23 >
24 > REPOS="$1"
24 > REPOS="$1"
25 > REV="$2"
25 > REV="$2"
26 > USER="$3"
26 > USER="$3"
27 > PROPNAME="$4"
27 > PROPNAME="$4"
28 > ACTION="$5"
28 > ACTION="$5"
29 >
29 >
30 > if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
30 > if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
31 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi
31 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi
32 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi
32 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi
33 >
33 >
34 > echo "Changing prohibited revision property" >&2
34 > echo "Changing prohibited revision property" >&2
35 > exit 1
35 > exit 1
36 > EOF
36 > EOF
37 $ chmod +x "$SVNREPOPATH"/hooks/pre-revprop-change
37 $ chmod +x "$SVNREPOPATH"/hooks/pre-revprop-change
38 $ svn co "$SVNREPOURL" "$SVNREPOPATH"-wc
38 $ svn co "$SVNREPOURL" "$SVNREPOPATH"-wc
39 Checked out revision 0.
39 Checked out revision 0.
40 $ cd "$SVNREPOPATH"-wc
40 $ cd "$SVNREPOPATH"-wc
41 $ echo a > a
41 $ echo a > a
42 $ svn add a
42 $ svn add a
43 A a
43 A a
44 $ svn ci -m'added a' a | filter_svn_output
44 $ svn ci -m'added a' a | filter_svn_output
45 Adding a
45 Adding a
46 Transmitting file data .
46 Transmitting file data .
47 Committed revision 1.
47 Committed revision 1.
48 $ cd ..
48 $ cd ..
49
49
50 initial roundtrip
50 initial roundtrip
51
51
52 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg | grep -v initializing
52 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg | grep -v initializing
53 scanning source...
53 scanning source...
54 sorting...
54 sorting...
55 converting...
55 converting...
56 0 added a
56 0 added a
57 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
57 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
58 scanning source...
58 scanning source...
59 sorting...
59 sorting...
60 converting...
60 converting...
61
61
62 second roundtrip should do nothing
62 second roundtrip should do nothing
63
63
64 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg
64 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg
65 scanning source...
65 scanning source...
66 sorting...
66 sorting...
67 converting...
67 converting...
68 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
68 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
69 scanning source...
69 scanning source...
70 sorting...
70 sorting...
71 converting...
71 converting...
72
72
73 new hg rev
73 new hg rev
74
74
75 $ hg clone "$SVNREPOPATH"-hg "$SVNREPOPATH"-work
75 $ hg clone "$SVNREPOPATH"-hg "$SVNREPOPATH"-work
76 updating to branch default
76 updating to branch default
77 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
77 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 $ cd "$SVNREPOPATH"-work
78 $ cd "$SVNREPOPATH"-work
79 $ echo b > b
79 $ echo b > b
80 $ hg add b
80 $ hg add b
81 $ hg ci -mb
81 $ hg ci -mb
82
82
83 adding an empty revision
83 adding an empty revision
84
84
85 $ hg qnew -m emtpy empty
85 $ hg qnew -m emtpy empty
86 $ hg qfinish -a
86 $ hg qfinish -a
87 $ cd ..
87 $ cd ..
88
88
89 echo hg to svn
89 echo hg to svn
90
90
91 $ hg --cwd "$SVNREPOPATH"-hg pull -q "$SVNREPOPATH"-work
91 $ hg --cwd "$SVNREPOPATH"-hg pull -q "$SVNREPOPATH"-work
92 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
92 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
93 scanning source...
93 scanning source...
94 sorting...
94 sorting...
95 converting...
95 converting...
96 1 b
96 1 b
97 0 emtpy
97 0 emtpy
98
98
99 svn back to hg should do nothing
99 svn back to hg should do nothing
100
100
101 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg
101 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg
102 scanning source...
102 scanning source...
103 sorting...
103 sorting...
104 converting...
104 converting...
105
105
106 hg back to svn should do nothing
106 hg back to svn should do nothing
107
107
108 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
108 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
109 scanning source...
109 scanning source...
110 sorting...
110 sorting...
111 converting...
111 converting...
112
112
113 verify which shamap format we are storing and must be able to handle
113 verify which shamap format we are storing and must be able to handle
114
114
115 $ cat svn-repo-hg/.hg/shamap
115 $ cat svn-repo-hg/.hg/shamap
116 svn:????????-????-????-????-????????????@1 ???????????????????????????????????????? (glob)
116 svn:????????-????-????-????-????????????@1 ???????????????????????????????????????? (glob)
117 svn:????????-????-????-????-????????????@2 ???????????????????????????????????????? (glob)
117 svn:????????-????-????-????-????????????@2 ???????????????????????????????????????? (glob)
118 svn:????????-????-????-????-????????????@2 ???????????????????????????????????????? (glob)
118 svn:????????-????-????-????-????????????@2 ???????????????????????????????????????? (glob)
119 $ cat svn-repo-wc/.svn/hg-shamap
119 $ cat svn-repo-wc/.svn/hg-shamap
120 ???????????????????????????????????????? 1 (glob)
120 ???????????????????????????????????????? 1 (glob)
121 ???????????????????????????????????????? svn:????????-????-????-????-????????????@2 (glob)
121 ???????????????????????????????????????? svn:????????-????-????-????-????????????@2 (glob)
122 ???????????????????????????????????????? svn:????????-????-????-????-????????????@2 (glob)
122 ???????????????????????????????????????? svn:????????-????-????-????-????????????@2 (glob)
@@ -1,255 +1,255
1 #require svn svn-bindings
1 #require svn svn-bindings
2
2
3 $ filter_svn_output () {
3 $ filter_svn_output () {
4 > egrep -v 'Committing|Updating' | sed -e 's/done$//' || true
4 > egrep -v 'Committing|Updating|(^$)' | sed -e 's/done$//' || true
5 > }
5 > }
6
6
7 $ cat >> $HGRCPATH <<EOF
7 $ cat >> $HGRCPATH <<EOF
8 > [extensions]
8 > [extensions]
9 > convert =
9 > convert =
10 > [convert]
10 > [convert]
11 > svn.trunk = mytrunk
11 > svn.trunk = mytrunk
12 > EOF
12 > EOF
13
13
14 $ svnadmin create svn-repo
14 $ svnadmin create svn-repo
15 $ SVNREPOPATH=`pwd`/svn-repo
15 $ SVNREPOPATH=`pwd`/svn-repo
16 #if windows
16 #if windows
17 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
17 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
18 #else
18 #else
19 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
19 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
20 #endif
20 #endif
21 $ INVALIDREVISIONID=svn:x2147622-4a9f-4db4-a8d3-13562ff547b2/proj%20B/mytrunk@1
21 $ INVALIDREVISIONID=svn:x2147622-4a9f-4db4-a8d3-13562ff547b2/proj%20B/mytrunk@1
22 $ VALIDREVISIONID=svn:a2147622-4a9f-4db4-a8d3-13562ff547b2/proj%20B/mytrunk/mytrunk@1
22 $ VALIDREVISIONID=svn:a2147622-4a9f-4db4-a8d3-13562ff547b2/proj%20B/mytrunk/mytrunk@1
23
23
24 Now test that it works with trunk/tags layout, but no branches yet.
24 Now test that it works with trunk/tags layout, but no branches yet.
25
25
26 Initial svn import
26 Initial svn import
27
27
28 $ mkdir projB
28 $ mkdir projB
29 $ cd projB
29 $ cd projB
30 $ mkdir mytrunk
30 $ mkdir mytrunk
31 $ mkdir tags
31 $ mkdir tags
32 $ cd ..
32 $ cd ..
33
33
34 $ svn import -m "init projB" projB "$SVNREPOURL/proj%20B" | filter_svn_output | sort
34 $ svn import -m "init projB" projB "$SVNREPOURL/proj%20B" | filter_svn_output | sort
35 Adding projB/mytrunk (glob)
35 Adding projB/mytrunk (glob)
36 Adding projB/tags (glob)
36 Adding projB/tags (glob)
37 Committed revision 1.
37 Committed revision 1.
38
38
39 Update svn repository
39 Update svn repository
40
40
41 $ svn co "$SVNREPOURL/proj%20B/mytrunk" B | filter_svn_output
41 $ svn co "$SVNREPOURL/proj%20B/mytrunk" B | filter_svn_output
42 Checked out revision 1.
42 Checked out revision 1.
43 $ cd B
43 $ cd B
44 $ echo hello > 'letter .txt'
44 $ echo hello > 'letter .txt'
45 $ svn add 'letter .txt' | filter_svn_output
45 $ svn add 'letter .txt' | filter_svn_output
46 A letter .txt
46 A letter .txt
47 $ svn ci -m hello | filter_svn_output
47 $ svn ci -m hello | filter_svn_output
48 Adding letter .txt
48 Adding letter .txt
49 Transmitting file data .
49 Transmitting file data .
50 Committed revision 2.
50 Committed revision 2.
51
51
52 $ svn-safe-append.py world 'letter .txt'
52 $ svn-safe-append.py world 'letter .txt'
53 $ svn ci -m world | filter_svn_output
53 $ svn ci -m world | filter_svn_output
54 Sending letter .txt
54 Sending letter .txt
55 Transmitting file data .
55 Transmitting file data .
56 Committed revision 3.
56 Committed revision 3.
57
57
58 $ svn copy -m "tag v0.1" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.1" | filter_svn_output
58 $ svn copy -m "tag v0.1" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.1" | filter_svn_output
59 Committed revision 4.
59 Committed revision 4.
60
60
61 $ svn-safe-append.py 'nice day today!' 'letter .txt'
61 $ svn-safe-append.py 'nice day today!' 'letter .txt'
62 $ svn ci -m "nice day" | filter_svn_output
62 $ svn ci -m "nice day" | filter_svn_output
63 Sending letter .txt
63 Sending letter .txt
64 Transmitting file data .
64 Transmitting file data .
65 Committed revision 5.
65 Committed revision 5.
66 $ cd ..
66 $ cd ..
67
67
68 Convert to hg once and also test localtimezone option
68 Convert to hg once and also test localtimezone option
69
69
70 NOTE: This doesn't check all time zones -- it merely determines that
70 NOTE: This doesn't check all time zones -- it merely determines that
71 the configuration option is taking effect.
71 the configuration option is taking effect.
72
72
73 An arbitrary (U.S.) time zone is used here. TZ=US/Hawaii is selected
73 An arbitrary (U.S.) time zone is used here. TZ=US/Hawaii is selected
74 since it does not use DST (unlike other U.S. time zones) and is always
74 since it does not use DST (unlike other U.S. time zones) and is always
75 a fixed difference from UTC.
75 a fixed difference from UTC.
76
76
77 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True "$SVNREPOURL/proj%20B" B-hg
77 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True "$SVNREPOURL/proj%20B" B-hg
78 initializing destination B-hg repository
78 initializing destination B-hg repository
79 scanning source...
79 scanning source...
80 sorting...
80 sorting...
81 converting...
81 converting...
82 3 init projB
82 3 init projB
83 2 hello
83 2 hello
84 1 world
84 1 world
85 0 nice day
85 0 nice day
86 updating tags
86 updating tags
87
87
88 Update svn repository again
88 Update svn repository again
89
89
90 $ cd B
90 $ cd B
91 $ svn-safe-append.py "see second letter" 'letter .txt'
91 $ svn-safe-append.py "see second letter" 'letter .txt'
92 $ echo "nice to meet you" > letter2.txt
92 $ echo "nice to meet you" > letter2.txt
93 $ svn add letter2.txt | filter_svn_output
93 $ svn add letter2.txt | filter_svn_output
94 A letter2.txt
94 A letter2.txt
95 $ svn ci -m "second letter" | filter_svn_output
95 $ svn ci -m "second letter" | filter_svn_output
96 Sending letter .txt
96 Sending letter .txt
97 Adding letter2.txt
97 Adding letter2.txt
98 Transmitting file data ..
98 Transmitting file data ..
99 Committed revision 6.
99 Committed revision 6.
100
100
101 $ svn copy -m "tag v0.2" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.2" | filter_svn_output
101 $ svn copy -m "tag v0.2" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.2" | filter_svn_output
102 Committed revision 7.
102 Committed revision 7.
103
103
104 $ svn-safe-append.py "blah-blah-blah" letter2.txt
104 $ svn-safe-append.py "blah-blah-blah" letter2.txt
105 $ svn ci -m "work in progress" | filter_svn_output
105 $ svn ci -m "work in progress" | filter_svn_output
106 Sending letter2.txt
106 Sending letter2.txt
107 Transmitting file data .
107 Transmitting file data .
108 Committed revision 8.
108 Committed revision 8.
109 $ cd ..
109 $ cd ..
110
110
111 $ hg convert -s svn "$SVNREPOURL/proj%20B/non-existent-path" dest
111 $ hg convert -s svn "$SVNREPOURL/proj%20B/non-existent-path" dest
112 initializing destination dest repository
112 initializing destination dest repository
113 abort: no revision found in module /proj B/non-existent-path
113 abort: no revision found in module /proj B/non-existent-path
114 [255]
114 [255]
115
115
116 ########################################
116 ########################################
117
117
118 Test incremental conversion
118 Test incremental conversion
119
119
120 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True "$SVNREPOURL/proj%20B" B-hg
120 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True "$SVNREPOURL/proj%20B" B-hg
121 scanning source...
121 scanning source...
122 sorting...
122 sorting...
123 converting...
123 converting...
124 1 second letter
124 1 second letter
125 0 work in progress
125 0 work in progress
126 updating tags
126 updating tags
127
127
128 $ cd B-hg
128 $ cd B-hg
129 $ hg log -G --template '{rev} {desc|firstline} date: {date|date} files: {files}\n'
129 $ hg log -G --template '{rev} {desc|firstline} date: {date|date} files: {files}\n'
130 o 7 update tags date: * +0000 files: .hgtags (glob)
130 o 7 update tags date: * +0000 files: .hgtags (glob)
131 |
131 |
132 o 6 work in progress date: * -1000 files: letter2.txt (glob)
132 o 6 work in progress date: * -1000 files: letter2.txt (glob)
133 |
133 |
134 o 5 second letter date: * -1000 files: letter .txt letter2.txt (glob)
134 o 5 second letter date: * -1000 files: letter .txt letter2.txt (glob)
135 |
135 |
136 o 4 update tags date: * +0000 files: .hgtags (glob)
136 o 4 update tags date: * +0000 files: .hgtags (glob)
137 |
137 |
138 o 3 nice day date: * -1000 files: letter .txt (glob)
138 o 3 nice day date: * -1000 files: letter .txt (glob)
139 |
139 |
140 o 2 world date: * -1000 files: letter .txt (glob)
140 o 2 world date: * -1000 files: letter .txt (glob)
141 |
141 |
142 o 1 hello date: * -1000 files: letter .txt (glob)
142 o 1 hello date: * -1000 files: letter .txt (glob)
143 |
143 |
144 o 0 init projB date: * -1000 files: (glob)
144 o 0 init projB date: * -1000 files: (glob)
145
145
146 $ hg tags -q
146 $ hg tags -q
147 tip
147 tip
148 v0.2
148 v0.2
149 v0.1
149 v0.1
150 $ cd ..
150 $ cd ..
151
151
152 Test filemap
152 Test filemap
153 $ echo 'include letter2.txt' > filemap
153 $ echo 'include letter2.txt' > filemap
154 $ hg convert --filemap filemap "$SVNREPOURL/proj%20B/mytrunk" fmap
154 $ hg convert --filemap filemap "$SVNREPOURL/proj%20B/mytrunk" fmap
155 initializing destination fmap repository
155 initializing destination fmap repository
156 scanning source...
156 scanning source...
157 sorting...
157 sorting...
158 converting...
158 converting...
159 5 init projB
159 5 init projB
160 4 hello
160 4 hello
161 3 world
161 3 world
162 2 nice day
162 2 nice day
163 1 second letter
163 1 second letter
164 0 work in progress
164 0 work in progress
165 $ hg -R fmap branch -q
165 $ hg -R fmap branch -q
166 default
166 default
167 $ hg log -G -R fmap --template '{rev} {desc|firstline} files: {files}\n'
167 $ hg log -G -R fmap --template '{rev} {desc|firstline} files: {files}\n'
168 o 1 work in progress files: letter2.txt
168 o 1 work in progress files: letter2.txt
169 |
169 |
170 o 0 second letter files: letter2.txt
170 o 0 second letter files: letter2.txt
171
171
172 Convert with --full adds and removes files that didn't change
172 Convert with --full adds and removes files that didn't change
173
173
174 $ cd B
174 $ cd B
175 $ echo >> "letter .txt"
175 $ echo >> "letter .txt"
176 $ svn ci -m 'nothing' | filter_svn_output
176 $ svn ci -m 'nothing' | filter_svn_output
177 Sending letter .txt
177 Sending letter .txt
178 Transmitting file data .
178 Transmitting file data .
179 Committed revision 9.
179 Committed revision 9.
180 $ cd ..
180 $ cd ..
181
181
182 $ echo 'rename letter2.txt letter3.txt' > filemap
182 $ echo 'rename letter2.txt letter3.txt' > filemap
183 $ hg convert --filemap filemap --full "$SVNREPOURL/proj%20B/mytrunk" fmap
183 $ hg convert --filemap filemap --full "$SVNREPOURL/proj%20B/mytrunk" fmap
184 scanning source...
184 scanning source...
185 sorting...
185 sorting...
186 converting...
186 converting...
187 0 nothing
187 0 nothing
188 $ hg -R fmap st --change tip
188 $ hg -R fmap st --change tip
189 A letter .txt
189 A letter .txt
190 A letter3.txt
190 A letter3.txt
191 R letter2.txt
191 R letter2.txt
192
192
193 test invalid splicemap1
193 test invalid splicemap1
194
194
195 $ cat > splicemap <<EOF
195 $ cat > splicemap <<EOF
196 > $INVALIDREVISIONID $VALIDREVISIONID
196 > $INVALIDREVISIONID $VALIDREVISIONID
197 > EOF
197 > EOF
198 $ hg convert --splicemap splicemap "$SVNREPOURL/proj%20B/mytrunk" smap
198 $ hg convert --splicemap splicemap "$SVNREPOURL/proj%20B/mytrunk" smap
199 initializing destination smap repository
199 initializing destination smap repository
200 abort: splicemap entry svn:x2147622-4a9f-4db4-a8d3-13562ff547b2/proj%20B/mytrunk@1 is not a valid revision identifier
200 abort: splicemap entry svn:x2147622-4a9f-4db4-a8d3-13562ff547b2/proj%20B/mytrunk@1 is not a valid revision identifier
201 [255]
201 [255]
202
202
203 Test stop revision
203 Test stop revision
204 $ hg convert --rev 1 "$SVNREPOURL/proj%20B/mytrunk" stoprev
204 $ hg convert --rev 1 "$SVNREPOURL/proj%20B/mytrunk" stoprev
205 initializing destination stoprev repository
205 initializing destination stoprev repository
206 scanning source...
206 scanning source...
207 sorting...
207 sorting...
208 converting...
208 converting...
209 0 init projB
209 0 init projB
210 $ hg -R stoprev branch -q
210 $ hg -R stoprev branch -q
211 default
211 default
212
212
213 Check convert_revision extra-records.
213 Check convert_revision extra-records.
214 This is also the only place testing more than one extra field in a revision.
214 This is also the only place testing more than one extra field in a revision.
215
215
216 $ cd stoprev
216 $ cd stoprev
217 $ hg tip --debug | grep extra
217 $ hg tip --debug | grep extra
218 extra: branch=default
218 extra: branch=default
219 extra: convert_revision=svn:........-....-....-....-............/proj B/mytrunk@1 (re)
219 extra: convert_revision=svn:........-....-....-....-............/proj B/mytrunk@1 (re)
220 $ cd ..
220 $ cd ..
221
221
222 Test converting empty heads (issue3347).
222 Test converting empty heads (issue3347).
223 Also tests getting logs directly without debugsvnlog.
223 Also tests getting logs directly without debugsvnlog.
224
224
225 $ svnadmin create svn-empty
225 $ svnadmin create svn-empty
226 $ svnadmin load -q svn-empty < "$TESTDIR/svn/empty.svndump"
226 $ svnadmin load -q svn-empty < "$TESTDIR/svn/empty.svndump"
227 $ hg --config convert.svn.trunk= --config convert.svn.debugsvnlog=0 convert svn-empty
227 $ hg --config convert.svn.trunk= --config convert.svn.debugsvnlog=0 convert svn-empty
228 assuming destination svn-empty-hg
228 assuming destination svn-empty-hg
229 initializing destination svn-empty-hg repository
229 initializing destination svn-empty-hg repository
230 scanning source...
230 scanning source...
231 sorting...
231 sorting...
232 converting...
232 converting...
233 1 init projA
233 1 init projA
234 0 adddir
234 0 adddir
235 $ hg --config convert.svn.trunk= convert "$SVNREPOURL/../svn-empty/trunk"
235 $ hg --config convert.svn.trunk= convert "$SVNREPOURL/../svn-empty/trunk"
236 assuming destination trunk-hg
236 assuming destination trunk-hg
237 initializing destination trunk-hg repository
237 initializing destination trunk-hg repository
238 scanning source...
238 scanning source...
239 sorting...
239 sorting...
240 converting...
240 converting...
241 1 init projA
241 1 init projA
242 0 adddir
242 0 adddir
243
243
244 Test that a too-new repository format is properly rejected:
244 Test that a too-new repository format is properly rejected:
245 $ mv svn-empty/format format
245 $ mv svn-empty/format format
246 $ echo 999 > svn-empty/format
246 $ echo 999 > svn-empty/format
247 It's important that this command explicitly specify svn, otherwise it
247 It's important that this command explicitly specify svn, otherwise it
248 can have surprising side effects (like falling back to a perforce
248 can have surprising side effects (like falling back to a perforce
249 depot that can be seen from the test environment and slurping from that.)
249 depot that can be seen from the test environment and slurping from that.)
250 $ hg convert --source-type svn svn-empty this-will-fail
250 $ hg convert --source-type svn svn-empty this-will-fail
251 initializing destination this-will-fail repository
251 initializing destination this-will-fail repository
252 file:/*/$TESTTMP/svn-empty does not look like a Subversion repository to libsvn version 1.*.* (glob)
252 file:/*/$TESTTMP/svn-empty does not look like a Subversion repository to libsvn version 1.*.* (glob)
253 abort: svn-empty: missing or unsupported repository
253 abort: svn-empty: missing or unsupported repository
254 [255]
254 [255]
255 $ mv format svn-empty/format
255 $ mv format svn-empty/format
@@ -1,643 +1,641
1 #require svn15
1 #require svn15
2
2
3 $ SVNREPOPATH=`pwd`/svn-repo
3 $ SVNREPOPATH=`pwd`/svn-repo
4 #if windows
4 #if windows
5 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
5 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
6 #else
6 #else
7 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
7 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
8 #endif
8 #endif
9
9
10 $ filter_svn_output () {
10 $ filter_svn_output () {
11 > egrep -v 'Committing|Transmitting|Updating' || true
11 > egrep -v 'Committing|Transmitting|Updating|(^$)' || true
12 > }
12 > }
13
13
14 create subversion repo
14 create subversion repo
15
15
16 $ WCROOT="`pwd`/svn-wc"
16 $ WCROOT="`pwd`/svn-wc"
17 $ svnadmin create svn-repo
17 $ svnadmin create svn-repo
18 $ svn co "$SVNREPOURL" svn-wc
18 $ svn co "$SVNREPOURL" svn-wc
19 Checked out revision 0.
19 Checked out revision 0.
20 $ cd svn-wc
20 $ cd svn-wc
21 $ mkdir src
21 $ mkdir src
22 $ echo alpha > src/alpha
22 $ echo alpha > src/alpha
23 $ svn add src
23 $ svn add src
24 A src
24 A src
25 A src/alpha (glob)
25 A src/alpha (glob)
26 $ mkdir externals
26 $ mkdir externals
27 $ echo other > externals/other
27 $ echo other > externals/other
28 $ svn add externals
28 $ svn add externals
29 A externals
29 A externals
30 A externals/other (glob)
30 A externals/other (glob)
31 $ svn ci -qm 'Add alpha'
31 $ svn ci -qm 'Add alpha'
32 $ svn up -q
32 $ svn up -q
33 $ echo "externals -r1 $SVNREPOURL/externals" > extdef
33 $ echo "externals -r1 $SVNREPOURL/externals" > extdef
34 $ svn propset -F extdef svn:externals src
34 $ svn propset -F extdef svn:externals src
35 property 'svn:externals' set on 'src'
35 property 'svn:externals' set on 'src'
36 $ svn ci -qm 'Setting externals'
36 $ svn ci -qm 'Setting externals'
37 $ cd ..
37 $ cd ..
38
38
39 create hg repo
39 create hg repo
40
40
41 $ mkdir sub
41 $ mkdir sub
42 $ cd sub
42 $ cd sub
43 $ hg init t
43 $ hg init t
44 $ cd t
44 $ cd t
45
45
46 first revision, no sub
46 first revision, no sub
47
47
48 $ echo a > a
48 $ echo a > a
49 $ hg ci -Am0
49 $ hg ci -Am0
50 adding a
50 adding a
51
51
52 add first svn sub with leading whitespaces
52 add first svn sub with leading whitespaces
53
53
54 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
54 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
55 $ echo "subdir/s = [svn] $SVNREPOURL/src" >> .hgsub
55 $ echo "subdir/s = [svn] $SVNREPOURL/src" >> .hgsub
56 $ svn co --quiet "$SVNREPOURL"/src s
56 $ svn co --quiet "$SVNREPOURL"/src s
57 $ mkdir subdir
57 $ mkdir subdir
58 $ svn co --quiet "$SVNREPOURL"/src subdir/s
58 $ svn co --quiet "$SVNREPOURL"/src subdir/s
59 $ hg add .hgsub
59 $ hg add .hgsub
60 $ hg ci -m1
60 $ hg ci -m1
61
61
62 make sure we avoid empty commits (issue2445)
62 make sure we avoid empty commits (issue2445)
63
63
64 $ hg sum
64 $ hg sum
65 parent: 1:* tip (glob)
65 parent: 1:* tip (glob)
66 1
66 1
67 branch: default
67 branch: default
68 commit: (clean)
68 commit: (clean)
69 update: (current)
69 update: (current)
70 phases: 2 draft
70 phases: 2 draft
71 $ hg ci -moops
71 $ hg ci -moops
72 nothing changed
72 nothing changed
73 [1]
73 [1]
74
74
75 debugsub
75 debugsub
76
76
77 $ hg debugsub
77 $ hg debugsub
78 path s
78 path s
79 source file://*/svn-repo/src (glob)
79 source file://*/svn-repo/src (glob)
80 revision 2
80 revision 2
81 path subdir/s
81 path subdir/s
82 source file://*/svn-repo/src (glob)
82 source file://*/svn-repo/src (glob)
83 revision 2
83 revision 2
84
84
85 change file in svn and hg, commit
85 change file in svn and hg, commit
86
86
87 $ echo a >> a
87 $ echo a >> a
88 $ echo alpha >> s/alpha
88 $ echo alpha >> s/alpha
89 $ hg sum
89 $ hg sum
90 parent: 1:* tip (glob)
90 parent: 1:* tip (glob)
91 1
91 1
92 branch: default
92 branch: default
93 commit: 1 modified, 1 subrepos
93 commit: 1 modified, 1 subrepos
94 update: (current)
94 update: (current)
95 phases: 2 draft
95 phases: 2 draft
96 $ hg commit --subrepos -m 'Message!' | filter_svn_output
96 $ hg commit --subrepos -m 'Message!' | filter_svn_output
97 committing subrepository s
97 committing subrepository s
98 Sending*s/alpha (glob)
98 Sending*s/alpha (glob)
99 Committed revision 3.
99 Committed revision 3.
100
101 Fetching external item into '*s/externals'* (glob)
100 Fetching external item into '*s/externals'* (glob)
102 External at revision 1.
101 External at revision 1.
103
104 At revision 3.
102 At revision 3.
105 $ hg debugsub
103 $ hg debugsub
106 path s
104 path s
107 source file://*/svn-repo/src (glob)
105 source file://*/svn-repo/src (glob)
108 revision 3
106 revision 3
109 path subdir/s
107 path subdir/s
110 source file://*/svn-repo/src (glob)
108 source file://*/svn-repo/src (glob)
111 revision 2
109 revision 2
112
110
113 missing svn file, commit should fail
111 missing svn file, commit should fail
114
112
115 $ rm s/alpha
113 $ rm s/alpha
116 $ hg commit --subrepos -m 'abort on missing file'
114 $ hg commit --subrepos -m 'abort on missing file'
117 committing subrepository s
115 committing subrepository s
118 abort: cannot commit missing svn entries (in subrepo s)
116 abort: cannot commit missing svn entries (in subrepo s)
119 [255]
117 [255]
120 $ svn revert s/alpha > /dev/null
118 $ svn revert s/alpha > /dev/null
121
119
122 add an unrelated revision in svn and update the subrepo to without
120 add an unrelated revision in svn and update the subrepo to without
123 bringing any changes.
121 bringing any changes.
124
122
125 $ svn mkdir "$SVNREPOURL/unrelated" -qm 'create unrelated'
123 $ svn mkdir "$SVNREPOURL/unrelated" -qm 'create unrelated'
126 $ svn up -q s
124 $ svn up -q s
127 $ hg sum
125 $ hg sum
128 parent: 2:* tip (glob)
126 parent: 2:* tip (glob)
129 Message!
127 Message!
130 branch: default
128 branch: default
131 commit: (clean)
129 commit: (clean)
132 update: (current)
130 update: (current)
133 phases: 3 draft
131 phases: 3 draft
134
132
135 $ echo a > s/a
133 $ echo a > s/a
136
134
137 should be empty despite change to s/a
135 should be empty despite change to s/a
138
136
139 $ hg st
137 $ hg st
140
138
141 add a commit from svn
139 add a commit from svn
142
140
143 $ cd "$WCROOT/src"
141 $ cd "$WCROOT/src"
144 $ svn up -q
142 $ svn up -q
145 $ echo xyz >> alpha
143 $ echo xyz >> alpha
146 $ svn propset svn:mime-type 'text/xml' alpha
144 $ svn propset svn:mime-type 'text/xml' alpha
147 property 'svn:mime-type' set on 'alpha'
145 property 'svn:mime-type' set on 'alpha'
148 $ svn ci -qm 'amend a from svn'
146 $ svn ci -qm 'amend a from svn'
149 $ cd ../../sub/t
147 $ cd ../../sub/t
150
148
151 this commit from hg will fail
149 this commit from hg will fail
152
150
153 $ echo zzz >> s/alpha
151 $ echo zzz >> s/alpha
154 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
152 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
155 committing subrepository s
153 committing subrepository s
156 abort: svn:*Commit failed (details follow): (glob)
154 abort: svn:*Commit failed (details follow): (glob)
157 [255]
155 [255]
158 $ svn revert -q s/alpha
156 $ svn revert -q s/alpha
159
157
160 this commit fails because of meta changes
158 this commit fails because of meta changes
161
159
162 $ svn propset svn:mime-type 'text/html' s/alpha
160 $ svn propset svn:mime-type 'text/html' s/alpha
163 property 'svn:mime-type' set on 's/alpha' (glob)
161 property 'svn:mime-type' set on 's/alpha' (glob)
164 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
162 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
165 committing subrepository s
163 committing subrepository s
166 abort: svn:*Commit failed (details follow): (glob)
164 abort: svn:*Commit failed (details follow): (glob)
167 [255]
165 [255]
168 $ svn revert -q s/alpha
166 $ svn revert -q s/alpha
169
167
170 this commit fails because of externals changes
168 this commit fails because of externals changes
171
169
172 $ echo zzz > s/externals/other
170 $ echo zzz > s/externals/other
173 $ hg ci --subrepos -m 'amend externals from hg'
171 $ hg ci --subrepos -m 'amend externals from hg'
174 committing subrepository s
172 committing subrepository s
175 abort: cannot commit svn externals (in subrepo s)
173 abort: cannot commit svn externals (in subrepo s)
176 [255]
174 [255]
177 $ hg diff --subrepos -r 1:2 | grep -v diff
175 $ hg diff --subrepos -r 1:2 | grep -v diff
178 --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
176 --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
179 +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
177 +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
180 @@ -1,2 +1,2 @@
178 @@ -1,2 +1,2 @@
181 -2 s
179 -2 s
182 +3 s
180 +3 s
183 2 subdir/s
181 2 subdir/s
184 --- a/a Thu Jan 01 00:00:00 1970 +0000
182 --- a/a Thu Jan 01 00:00:00 1970 +0000
185 +++ b/a Thu Jan 01 00:00:00 1970 +0000
183 +++ b/a Thu Jan 01 00:00:00 1970 +0000
186 @@ -1,1 +1,2 @@
184 @@ -1,1 +1,2 @@
187 a
185 a
188 +a
186 +a
189 $ svn revert -q s/externals/other
187 $ svn revert -q s/externals/other
190
188
191 this commit fails because of externals meta changes
189 this commit fails because of externals meta changes
192
190
193 $ svn propset svn:mime-type 'text/html' s/externals/other
191 $ svn propset svn:mime-type 'text/html' s/externals/other
194 property 'svn:mime-type' set on 's/externals/other' (glob)
192 property 'svn:mime-type' set on 's/externals/other' (glob)
195 $ hg ci --subrepos -m 'amend externals from hg'
193 $ hg ci --subrepos -m 'amend externals from hg'
196 committing subrepository s
194 committing subrepository s
197 abort: cannot commit svn externals (in subrepo s)
195 abort: cannot commit svn externals (in subrepo s)
198 [255]
196 [255]
199 $ svn revert -q s/externals/other
197 $ svn revert -q s/externals/other
200
198
201 clone
199 clone
202
200
203 $ cd ..
201 $ cd ..
204 $ hg clone t tc
202 $ hg clone t tc
205 updating to branch default
203 updating to branch default
206 A tc/s/alpha (glob)
204 A tc/s/alpha (glob)
207 U tc/s (glob)
205 U tc/s (glob)
208
206
209 Fetching external item into 'tc/s/externals'* (glob)
207 Fetching external item into 'tc/s/externals'* (glob)
210 A tc/s/externals/other (glob)
208 A tc/s/externals/other (glob)
211 Checked out external at revision 1.
209 Checked out external at revision 1.
212
210
213 Checked out revision 3.
211 Checked out revision 3.
214 A tc/subdir/s/alpha (glob)
212 A tc/subdir/s/alpha (glob)
215 U tc/subdir/s (glob)
213 U tc/subdir/s (glob)
216
214
217 Fetching external item into 'tc/subdir/s/externals'* (glob)
215 Fetching external item into 'tc/subdir/s/externals'* (glob)
218 A tc/subdir/s/externals/other (glob)
216 A tc/subdir/s/externals/other (glob)
219 Checked out external at revision 1.
217 Checked out external at revision 1.
220
218
221 Checked out revision 2.
219 Checked out revision 2.
222 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
220 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 $ cd tc
221 $ cd tc
224
222
225 debugsub in clone
223 debugsub in clone
226
224
227 $ hg debugsub
225 $ hg debugsub
228 path s
226 path s
229 source file://*/svn-repo/src (glob)
227 source file://*/svn-repo/src (glob)
230 revision 3
228 revision 3
231 path subdir/s
229 path subdir/s
232 source file://*/svn-repo/src (glob)
230 source file://*/svn-repo/src (glob)
233 revision 2
231 revision 2
234
232
235 verify subrepo is contained within the repo directory
233 verify subrepo is contained within the repo directory
236
234
237 $ $PYTHON -c "import os.path; print os.path.exists('s')"
235 $ $PYTHON -c "import os.path; print os.path.exists('s')"
238 True
236 True
239
237
240 update to nullrev (must delete the subrepo)
238 update to nullrev (must delete the subrepo)
241
239
242 $ hg up null
240 $ hg up null
243 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
241 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
244 $ ls
242 $ ls
245
243
246 Check hg update --clean
244 Check hg update --clean
247 $ cd "$TESTTMP/sub/t"
245 $ cd "$TESTTMP/sub/t"
248 $ cd s
246 $ cd s
249 $ echo c0 > alpha
247 $ echo c0 > alpha
250 $ echo c1 > f1
248 $ echo c1 > f1
251 $ echo c1 > f2
249 $ echo c1 > f2
252 $ svn add f1 -q
250 $ svn add f1 -q
253 $ svn status | sort
251 $ svn status | sort
254
252
255 ? * a (glob)
253 ? * a (glob)
256 ? * f2 (glob)
254 ? * f2 (glob)
257 A * f1 (glob)
255 A * f1 (glob)
258 M * alpha (glob)
256 M * alpha (glob)
259 Performing status on external item at 'externals'* (glob)
257 Performing status on external item at 'externals'* (glob)
260 X * externals (glob)
258 X * externals (glob)
261 $ cd ../..
259 $ cd ../..
262 $ hg -R t update -C
260 $ hg -R t update -C
263
261
264 Fetching external item into 't/s/externals'* (glob)
262 Fetching external item into 't/s/externals'* (glob)
265 Checked out external at revision 1.
263 Checked out external at revision 1.
266
264
267 Checked out revision 3.
265 Checked out revision 3.
268 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
266 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
269 $ cd t/s
267 $ cd t/s
270 $ svn status | sort
268 $ svn status | sort
271
269
272 ? * a (glob)
270 ? * a (glob)
273 ? * f1 (glob)
271 ? * f1 (glob)
274 ? * f2 (glob)
272 ? * f2 (glob)
275 Performing status on external item at 'externals'* (glob)
273 Performing status on external item at 'externals'* (glob)
276 X * externals (glob)
274 X * externals (glob)
277
275
278 Sticky subrepositories, no changes
276 Sticky subrepositories, no changes
279 $ cd "$TESTTMP/sub/t"
277 $ cd "$TESTTMP/sub/t"
280 $ hg id -n
278 $ hg id -n
281 2
279 2
282 $ cd s
280 $ cd s
283 $ svnversion
281 $ svnversion
284 3
282 3
285 $ cd ..
283 $ cd ..
286 $ hg update 1
284 $ hg update 1
287 U *s/alpha (glob)
285 U *s/alpha (glob)
288
286
289 Fetching external item into '*s/externals'* (glob)
287 Fetching external item into '*s/externals'* (glob)
290 Checked out external at revision 1.
288 Checked out external at revision 1.
291
289
292 Checked out revision 2.
290 Checked out revision 2.
293 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
291 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
294 $ hg id -n
292 $ hg id -n
295 1
293 1
296 $ cd s
294 $ cd s
297 $ svnversion
295 $ svnversion
298 2
296 2
299 $ cd ..
297 $ cd ..
300
298
301 Sticky subrepositories, file changes
299 Sticky subrepositories, file changes
302 $ touch s/f1
300 $ touch s/f1
303 $ cd s
301 $ cd s
304 $ svn add f1
302 $ svn add f1
305 A f1
303 A f1
306 $ cd ..
304 $ cd ..
307 $ hg id -n
305 $ hg id -n
308 1+
306 1+
309 $ cd s
307 $ cd s
310 $ svnversion
308 $ svnversion
311 2M
309 2M
312 $ cd ..
310 $ cd ..
313 $ hg update tip
311 $ hg update tip
314 subrepository s diverged (local revision: 2, remote revision: 3)
312 subrepository s diverged (local revision: 2, remote revision: 3)
315 (M)erge, keep (l)ocal or keep (r)emote? m
313 (M)erge, keep (l)ocal or keep (r)emote? m
316 subrepository sources for s differ
314 subrepository sources for s differ
317 use (l)ocal source (2) or (r)emote source (3)? l
315 use (l)ocal source (2) or (r)emote source (3)? l
318 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
316 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
319 $ hg id -n
317 $ hg id -n
320 2+
318 2+
321 $ cd s
319 $ cd s
322 $ svnversion
320 $ svnversion
323 2M
321 2M
324 $ cd ..
322 $ cd ..
325 $ hg update --clean tip
323 $ hg update --clean tip
326 U *s/alpha (glob)
324 U *s/alpha (glob)
327
325
328 Fetching external item into '*s/externals'* (glob)
326 Fetching external item into '*s/externals'* (glob)
329 Checked out external at revision 1.
327 Checked out external at revision 1.
330
328
331 Checked out revision 3.
329 Checked out revision 3.
332 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
330 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
333
331
334 Sticky subrepository, revision updates
332 Sticky subrepository, revision updates
335 $ hg id -n
333 $ hg id -n
336 2
334 2
337 $ cd s
335 $ cd s
338 $ svnversion
336 $ svnversion
339 3
337 3
340 $ cd ..
338 $ cd ..
341 $ cd s
339 $ cd s
342 $ svn update -qr 1
340 $ svn update -qr 1
343 $ cd ..
341 $ cd ..
344 $ hg update 1
342 $ hg update 1
345 subrepository s diverged (local revision: 3, remote revision: 2)
343 subrepository s diverged (local revision: 3, remote revision: 2)
346 (M)erge, keep (l)ocal or keep (r)emote? m
344 (M)erge, keep (l)ocal or keep (r)emote? m
347 subrepository sources for s differ (in checked out version)
345 subrepository sources for s differ (in checked out version)
348 use (l)ocal source (1) or (r)emote source (2)? l
346 use (l)ocal source (1) or (r)emote source (2)? l
349 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
347 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
350 $ hg id -n
348 $ hg id -n
351 1+
349 1+
352 $ cd s
350 $ cd s
353 $ svnversion
351 $ svnversion
354 1
352 1
355 $ cd ..
353 $ cd ..
356
354
357 Sticky subrepository, file changes and revision updates
355 Sticky subrepository, file changes and revision updates
358 $ touch s/f1
356 $ touch s/f1
359 $ cd s
357 $ cd s
360 $ svn add f1
358 $ svn add f1
361 A f1
359 A f1
362 $ svnversion
360 $ svnversion
363 1M
361 1M
364 $ cd ..
362 $ cd ..
365 $ hg id -n
363 $ hg id -n
366 1+
364 1+
367 $ hg update tip
365 $ hg update tip
368 subrepository s diverged (local revision: 3, remote revision: 3)
366 subrepository s diverged (local revision: 3, remote revision: 3)
369 (M)erge, keep (l)ocal or keep (r)emote? m
367 (M)erge, keep (l)ocal or keep (r)emote? m
370 subrepository sources for s differ
368 subrepository sources for s differ
371 use (l)ocal source (1) or (r)emote source (3)? l
369 use (l)ocal source (1) or (r)emote source (3)? l
372 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
373 $ hg id -n
371 $ hg id -n
374 2+
372 2+
375 $ cd s
373 $ cd s
376 $ svnversion
374 $ svnversion
377 1M
375 1M
378 $ cd ..
376 $ cd ..
379
377
380 Sticky repository, update --clean
378 Sticky repository, update --clean
381 $ hg update --clean tip | grep -v 's[/\]externals[/\]other'
379 $ hg update --clean tip | grep -v 's[/\]externals[/\]other'
382 U *s/alpha (glob)
380 U *s/alpha (glob)
383 U *s (glob)
381 U *s (glob)
384
382
385 Fetching external item into '*s/externals'* (glob)
383 Fetching external item into '*s/externals'* (glob)
386 Checked out external at revision 1.
384 Checked out external at revision 1.
387
385
388 Checked out revision 3.
386 Checked out revision 3.
389 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
387 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
390 $ hg id -n
388 $ hg id -n
391 2
389 2
392 $ cd s
390 $ cd s
393 $ svnversion
391 $ svnversion
394 3
392 3
395 $ cd ..
393 $ cd ..
396
394
397 Test subrepo already at intended revision:
395 Test subrepo already at intended revision:
398 $ cd s
396 $ cd s
399 $ svn update -qr 2
397 $ svn update -qr 2
400 $ cd ..
398 $ cd ..
401 $ hg update 1
399 $ hg update 1
402 subrepository s diverged (local revision: 3, remote revision: 2)
400 subrepository s diverged (local revision: 3, remote revision: 2)
403 (M)erge, keep (l)ocal or keep (r)emote? m
401 (M)erge, keep (l)ocal or keep (r)emote? m
404 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
402 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
405 $ hg id -n
403 $ hg id -n
406 1+
404 1+
407 $ cd s
405 $ cd s
408 $ svnversion
406 $ svnversion
409 2
407 2
410 $ cd ..
408 $ cd ..
411
409
412 Test case where subversion would fail to update the subrepo because there
410 Test case where subversion would fail to update the subrepo because there
413 are unknown directories being replaced by tracked ones (happens with rebase).
411 are unknown directories being replaced by tracked ones (happens with rebase).
414
412
415 $ cd "$WCROOT/src"
413 $ cd "$WCROOT/src"
416 $ mkdir dir
414 $ mkdir dir
417 $ echo epsilon.py > dir/epsilon.py
415 $ echo epsilon.py > dir/epsilon.py
418 $ svn add dir
416 $ svn add dir
419 A dir
417 A dir
420 A dir/epsilon.py (glob)
418 A dir/epsilon.py (glob)
421 $ svn ci -qm 'Add dir/epsilon.py'
419 $ svn ci -qm 'Add dir/epsilon.py'
422 $ cd ../..
420 $ cd ../..
423 $ hg init rebaserepo
421 $ hg init rebaserepo
424 $ cd rebaserepo
422 $ cd rebaserepo
425 $ svn co -r5 --quiet "$SVNREPOURL"/src s
423 $ svn co -r5 --quiet "$SVNREPOURL"/src s
426 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
424 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
427 $ hg add .hgsub
425 $ hg add .hgsub
428 $ hg ci -m addsub
426 $ hg ci -m addsub
429 $ echo a > a
427 $ echo a > a
430 $ hg add .
428 $ hg add .
431 adding a
429 adding a
432 $ hg ci -m adda
430 $ hg ci -m adda
433 $ hg up 0
431 $ hg up 0
434 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
432 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
435 $ svn up -qr6 s
433 $ svn up -qr6 s
436 $ hg ci -m updatesub
434 $ hg ci -m updatesub
437 created new head
435 created new head
438 $ echo pyc > s/dir/epsilon.pyc
436 $ echo pyc > s/dir/epsilon.pyc
439 $ hg up 1
437 $ hg up 1
440 D *s/dir (glob)
438 D *s/dir (glob)
441
439
442 Fetching external item into '*s/externals'* (glob)
440 Fetching external item into '*s/externals'* (glob)
443 Checked out external at revision 1.
441 Checked out external at revision 1.
444
442
445 Checked out revision 5.
443 Checked out revision 5.
446 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
444 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
447 $ hg up -q 2
445 $ hg up -q 2
448
446
449 Modify one of the externals to point to a different path so we can
447 Modify one of the externals to point to a different path so we can
450 test having obstructions when switching branches on checkout:
448 test having obstructions when switching branches on checkout:
451 $ hg checkout tip
449 $ hg checkout tip
452 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
450 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
453 $ echo "obstruct = [svn] $SVNREPOURL/externals" >> .hgsub
451 $ echo "obstruct = [svn] $SVNREPOURL/externals" >> .hgsub
454 $ svn co -r5 --quiet "$SVNREPOURL"/externals obstruct
452 $ svn co -r5 --quiet "$SVNREPOURL"/externals obstruct
455 $ hg commit -m 'Start making obstructed working copy'
453 $ hg commit -m 'Start making obstructed working copy'
456 $ hg book other
454 $ hg book other
457 $ hg co -r 'p1(tip)'
455 $ hg co -r 'p1(tip)'
458 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
456 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
459 (leaving bookmark other)
457 (leaving bookmark other)
460 $ echo "obstruct = [svn] $SVNREPOURL/src" >> .hgsub
458 $ echo "obstruct = [svn] $SVNREPOURL/src" >> .hgsub
461 $ svn co -r5 --quiet "$SVNREPOURL"/src obstruct
459 $ svn co -r5 --quiet "$SVNREPOURL"/src obstruct
462 $ hg commit -m 'Other branch which will be obstructed'
460 $ hg commit -m 'Other branch which will be obstructed'
463 created new head
461 created new head
464
462
465 Switching back to the head where we have another path mapped to the
463 Switching back to the head where we have another path mapped to the
466 same subrepo should work if the subrepo is clean.
464 same subrepo should work if the subrepo is clean.
467 $ hg co other
465 $ hg co other
468 A *obstruct/other (glob)
466 A *obstruct/other (glob)
469 Checked out revision 1.
467 Checked out revision 1.
470 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
468 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
471 (activating bookmark other)
469 (activating bookmark other)
472
470
473 This is surprising, but is also correct based on the current code:
471 This is surprising, but is also correct based on the current code:
474 $ echo "updating should (maybe) fail" > obstruct/other
472 $ echo "updating should (maybe) fail" > obstruct/other
475 $ hg co tip
473 $ hg co tip
476 abort: uncommitted changes
474 abort: uncommitted changes
477 (commit or update --clean to discard changes)
475 (commit or update --clean to discard changes)
478 [255]
476 [255]
479
477
480 Point to a Subversion branch which has since been deleted and recreated
478 Point to a Subversion branch which has since been deleted and recreated
481 First, create that condition in the repository.
479 First, create that condition in the repository.
482
480
483 $ hg ci --subrepos -m cleanup | filter_svn_output
481 $ hg ci --subrepos -m cleanup | filter_svn_output
484 committing subrepository obstruct
482 committing subrepository obstruct
485 Sending obstruct/other (glob)
483 Sending obstruct/other (glob)
486 Committed revision 7.
484 Committed revision 7.
487 At revision 7.
485 At revision 7.
488 $ svn mkdir -qm "baseline" $SVNREPOURL/trunk
486 $ svn mkdir -qm "baseline" $SVNREPOURL/trunk
489 $ svn copy -qm "initial branch" $SVNREPOURL/trunk $SVNREPOURL/branch
487 $ svn copy -qm "initial branch" $SVNREPOURL/trunk $SVNREPOURL/branch
490 $ svn co --quiet "$SVNREPOURL"/branch tempwc
488 $ svn co --quiet "$SVNREPOURL"/branch tempwc
491 $ cd tempwc
489 $ cd tempwc
492 $ echo "something old" > somethingold
490 $ echo "something old" > somethingold
493 $ svn add somethingold
491 $ svn add somethingold
494 A somethingold
492 A somethingold
495 $ svn ci -qm 'Something old'
493 $ svn ci -qm 'Something old'
496 $ svn rm -qm "remove branch" $SVNREPOURL/branch
494 $ svn rm -qm "remove branch" $SVNREPOURL/branch
497 $ svn copy -qm "recreate branch" $SVNREPOURL/trunk $SVNREPOURL/branch
495 $ svn copy -qm "recreate branch" $SVNREPOURL/trunk $SVNREPOURL/branch
498 $ svn up -q
496 $ svn up -q
499 $ echo "something new" > somethingnew
497 $ echo "something new" > somethingnew
500 $ svn add somethingnew
498 $ svn add somethingnew
501 A somethingnew
499 A somethingnew
502 $ svn ci -qm 'Something new'
500 $ svn ci -qm 'Something new'
503 $ cd ..
501 $ cd ..
504 $ rm -rf tempwc
502 $ rm -rf tempwc
505 $ svn co "$SVNREPOURL/branch"@10 recreated
503 $ svn co "$SVNREPOURL/branch"@10 recreated
506 A recreated/somethingold (glob)
504 A recreated/somethingold (glob)
507 Checked out revision 10.
505 Checked out revision 10.
508 $ echo "recreated = [svn] $SVNREPOURL/branch" >> .hgsub
506 $ echo "recreated = [svn] $SVNREPOURL/branch" >> .hgsub
509 $ hg ci -m addsub
507 $ hg ci -m addsub
510 $ cd recreated
508 $ cd recreated
511 $ svn up -q
509 $ svn up -q
512 $ cd ..
510 $ cd ..
513 $ hg ci -m updatesub
511 $ hg ci -m updatesub
514 $ hg up -r-2
512 $ hg up -r-2
515 D *recreated/somethingnew (glob)
513 D *recreated/somethingnew (glob)
516 A *recreated/somethingold (glob)
514 A *recreated/somethingold (glob)
517 Checked out revision 10.
515 Checked out revision 10.
518 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
516 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
519 (leaving bookmark other)
517 (leaving bookmark other)
520 $ test -f recreated/somethingold
518 $ test -f recreated/somethingold
521
519
522 Test archive
520 Test archive
523
521
524 $ hg archive -S ../archive-all --debug --config progress.debug=true
522 $ hg archive -S ../archive-all --debug --config progress.debug=true
525 archiving: 0/2 files (0.00%)
523 archiving: 0/2 files (0.00%)
526 archiving: .hgsub 1/2 files (50.00%)
524 archiving: .hgsub 1/2 files (50.00%)
527 archiving: .hgsubstate 2/2 files (100.00%)
525 archiving: .hgsubstate 2/2 files (100.00%)
528 archiving (obstruct): 0/1 files (0.00%)
526 archiving (obstruct): 0/1 files (0.00%)
529 archiving (obstruct): 1/1 files (100.00%)
527 archiving (obstruct): 1/1 files (100.00%)
530 archiving (recreated): 0/1 files (0.00%)
528 archiving (recreated): 0/1 files (0.00%)
531 archiving (recreated): 1/1 files (100.00%)
529 archiving (recreated): 1/1 files (100.00%)
532 archiving (s): 0/2 files (0.00%)
530 archiving (s): 0/2 files (0.00%)
533 archiving (s): 1/2 files (50.00%)
531 archiving (s): 1/2 files (50.00%)
534 archiving (s): 2/2 files (100.00%)
532 archiving (s): 2/2 files (100.00%)
535
533
536 $ hg archive -S ../archive-exclude --debug --config progress.debug=true -X **old
534 $ hg archive -S ../archive-exclude --debug --config progress.debug=true -X **old
537 archiving: 0/2 files (0.00%)
535 archiving: 0/2 files (0.00%)
538 archiving: .hgsub 1/2 files (50.00%)
536 archiving: .hgsub 1/2 files (50.00%)
539 archiving: .hgsubstate 2/2 files (100.00%)
537 archiving: .hgsubstate 2/2 files (100.00%)
540 archiving (obstruct): 0/1 files (0.00%)
538 archiving (obstruct): 0/1 files (0.00%)
541 archiving (obstruct): 1/1 files (100.00%)
539 archiving (obstruct): 1/1 files (100.00%)
542 archiving (recreated): 0 files
540 archiving (recreated): 0 files
543 archiving (s): 0/2 files (0.00%)
541 archiving (s): 0/2 files (0.00%)
544 archiving (s): 1/2 files (50.00%)
542 archiving (s): 1/2 files (50.00%)
545 archiving (s): 2/2 files (100.00%)
543 archiving (s): 2/2 files (100.00%)
546 $ find ../archive-exclude | sort
544 $ find ../archive-exclude | sort
547 ../archive-exclude
545 ../archive-exclude
548 ../archive-exclude/.hg_archival.txt
546 ../archive-exclude/.hg_archival.txt
549 ../archive-exclude/.hgsub
547 ../archive-exclude/.hgsub
550 ../archive-exclude/.hgsubstate
548 ../archive-exclude/.hgsubstate
551 ../archive-exclude/obstruct
549 ../archive-exclude/obstruct
552 ../archive-exclude/obstruct/other
550 ../archive-exclude/obstruct/other
553 ../archive-exclude/s
551 ../archive-exclude/s
554 ../archive-exclude/s/alpha
552 ../archive-exclude/s/alpha
555 ../archive-exclude/s/dir
553 ../archive-exclude/s/dir
556 ../archive-exclude/s/dir/epsilon.py
554 ../archive-exclude/s/dir/epsilon.py
557
555
558 Test forgetting files, not implemented in svn subrepo, used to
556 Test forgetting files, not implemented in svn subrepo, used to
559 traceback
557 traceback
560
558
561 #if no-windows
559 #if no-windows
562 $ hg forget 'notafile*'
560 $ hg forget 'notafile*'
563 notafile*: No such file or directory
561 notafile*: No such file or directory
564 [1]
562 [1]
565 #else
563 #else
566 $ hg forget 'notafile'
564 $ hg forget 'notafile'
567 notafile: * (glob)
565 notafile: * (glob)
568 [1]
566 [1]
569 #endif
567 #endif
570
568
571 Test a subrepo referencing a just moved svn path. Last commit rev will
569 Test a subrepo referencing a just moved svn path. Last commit rev will
572 be different from the revision, and the path will be different as
570 be different from the revision, and the path will be different as
573 well.
571 well.
574
572
575 $ cd "$WCROOT"
573 $ cd "$WCROOT"
576 $ svn up > /dev/null
574 $ svn up > /dev/null
577 $ mkdir trunk/subdir branches
575 $ mkdir trunk/subdir branches
578 $ echo a > trunk/subdir/a
576 $ echo a > trunk/subdir/a
579 $ svn add trunk/subdir branches
577 $ svn add trunk/subdir branches
580 A trunk/subdir (glob)
578 A trunk/subdir (glob)
581 A trunk/subdir/a (glob)
579 A trunk/subdir/a (glob)
582 A branches
580 A branches
583 $ svn ci -qm addsubdir
581 $ svn ci -qm addsubdir
584 $ svn cp -qm branchtrunk $SVNREPOURL/trunk $SVNREPOURL/branches/somebranch
582 $ svn cp -qm branchtrunk $SVNREPOURL/trunk $SVNREPOURL/branches/somebranch
585 $ cd ..
583 $ cd ..
586
584
587 $ hg init repo2
585 $ hg init repo2
588 $ cd repo2
586 $ cd repo2
589 $ svn co $SVNREPOURL/branches/somebranch/subdir
587 $ svn co $SVNREPOURL/branches/somebranch/subdir
590 A subdir/a (glob)
588 A subdir/a (glob)
591 Checked out revision 15.
589 Checked out revision 15.
592 $ echo "subdir = [svn] $SVNREPOURL/branches/somebranch/subdir" > .hgsub
590 $ echo "subdir = [svn] $SVNREPOURL/branches/somebranch/subdir" > .hgsub
593 $ hg add .hgsub
591 $ hg add .hgsub
594 $ hg ci -m addsub
592 $ hg ci -m addsub
595 $ hg up null
593 $ hg up null
596 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
594 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
597 $ hg up
595 $ hg up
598 A *subdir/a (glob)
596 A *subdir/a (glob)
599 Checked out revision 15.
597 Checked out revision 15.
600 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
598 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
601 $ cd ..
599 $ cd ..
602
600
603 Test sanitizing ".hg/hgrc" in subrepo
601 Test sanitizing ".hg/hgrc" in subrepo
604
602
605 $ cd sub/t
603 $ cd sub/t
606 $ hg update -q -C tip
604 $ hg update -q -C tip
607 $ cd s
605 $ cd s
608 $ mkdir .hg
606 $ mkdir .hg
609 $ echo '.hg/hgrc in svn repo' > .hg/hgrc
607 $ echo '.hg/hgrc in svn repo' > .hg/hgrc
610 $ mkdir -p sub/.hg
608 $ mkdir -p sub/.hg
611 $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc
609 $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc
612 $ svn add .hg sub
610 $ svn add .hg sub
613 A .hg
611 A .hg
614 A .hg/hgrc (glob)
612 A .hg/hgrc (glob)
615 A sub
613 A sub
616 A sub/.hg (glob)
614 A sub/.hg (glob)
617 A sub/.hg/hgrc (glob)
615 A sub/.hg/hgrc (glob)
618 $ svn ci -qm 'add .hg/hgrc to be sanitized at hg update'
616 $ svn ci -qm 'add .hg/hgrc to be sanitized at hg update'
619 $ svn up -q
617 $ svn up -q
620 $ cd ..
618 $ cd ..
621 $ hg commit -S -m 'commit with svn revision including .hg/hgrc'
619 $ hg commit -S -m 'commit with svn revision including .hg/hgrc'
622 $ grep ' s$' .hgsubstate
620 $ grep ' s$' .hgsubstate
623 16 s
621 16 s
624 $ cd ..
622 $ cd ..
625
623
626 $ hg -R tc pull -u -q 2>&1 | sort
624 $ hg -R tc pull -u -q 2>&1 | sort
627 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg' (glob)
625 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg' (glob)
628 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg' (glob)
626 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg' (glob)
629 $ cd tc
627 $ cd tc
630 $ grep ' s$' .hgsubstate
628 $ grep ' s$' .hgsubstate
631 16 s
629 16 s
632 $ test -f s/.hg/hgrc
630 $ test -f s/.hg/hgrc
633 [1]
631 [1]
634 $ test -f s/sub/.hg/hgrc
632 $ test -f s/sub/.hg/hgrc
635 [1]
633 [1]
636
634
637 Test that sanitizing is omitted in meta data area:
635 Test that sanitizing is omitted in meta data area:
638
636
639 $ mkdir s/.svn/.hg
637 $ mkdir s/.svn/.hg
640 $ echo '.hg/hgrc in svn metadata area' > s/.svn/.hg/hgrc
638 $ echo '.hg/hgrc in svn metadata area' > s/.svn/.hg/hgrc
641 $ hg update -q -C '.^1'
639 $ hg update -q -C '.^1'
642
640
643 $ cd ../..
641 $ cd ../..
General Comments 0
You need to be logged in to leave comments. Login now