Show More
@@ -8,6 +8,8 b'' | |||||
8 | # Relative path to the trunk (default: "trunk") |
|
8 | # Relative path to the trunk (default: "trunk") | |
9 | # convert.svn.branches |
|
9 | # convert.svn.branches | |
10 | # Relative path to tree of branches (default: "branches") |
|
10 | # Relative path to tree of branches (default: "branches") | |
|
11 | # convert.svn.tags | |||
|
12 | # Relative path to tree of tags (default: "tags") | |||
11 | # |
|
13 | # | |
12 | # Set these in a hgrc, or on the command line as follows: |
|
14 | # Set these in a hgrc, or on the command line as follows: | |
13 | # |
|
15 | # | |
@@ -170,11 +172,13 b' class svn_source(converter_source):' | |||||
170 | rpath = self.url.strip('/') |
|
172 | rpath = self.url.strip('/') | |
171 | cfgtrunk = self.ui.config('convert', 'svn.trunk') |
|
173 | cfgtrunk = self.ui.config('convert', 'svn.trunk') | |
172 | cfgbranches = self.ui.config('convert', 'svn.branches') |
|
174 | cfgbranches = self.ui.config('convert', 'svn.branches') | |
|
175 | cfgtags = self.ui.config('convert', 'svn.tags') | |||
173 | trunk = (cfgtrunk or 'trunk').strip('/') |
|
176 | trunk = (cfgtrunk or 'trunk').strip('/') | |
174 | branches = (cfgbranches or 'branches').strip('/') |
|
177 | branches = (cfgbranches or 'branches').strip('/') | |
175 | if self.exists(trunk, rev) and self.exists(branches, rev): |
|
178 | tags = (cfgtags or 'tags').strip('/') | |
176 | self.ui.note('found trunk at %r and branches at %r\n' % |
|
179 | if self.exists(trunk, rev) and self.exists(branches, rev) and self.exists(tags, rev): | |
177 | (trunk, branches)) |
|
180 | self.ui.note('found trunk at %r, branches at %r and tags at %r\n' % | |
|
181 | (trunk, branches, tags)) | |||
178 | oldmodule = self.module |
|
182 | oldmodule = self.module | |
179 | self.module += '/' + trunk |
|
183 | self.module += '/' + trunk | |
180 | lt = self.latest(self.module, self.last_changed) |
|
184 | lt = self.latest(self.module, self.last_changed) | |
@@ -184,18 +188,25 b' class svn_source(converter_source):' | |||||
184 | self.ctx) |
|
188 | self.ctx) | |
185 | for branch in branchnames.keys(): |
|
189 | for branch in branchnames.keys(): | |
186 | if oldmodule: |
|
190 | if oldmodule: | |
187 |
module = |
|
191 | module = oldmodule + '/' + branches + '/' + branch | |
188 | else: |
|
192 | else: | |
189 | module = '/' + branches + '/' + branch |
|
193 | module = '/' + branches + '/' + branch | |
190 | brevnum = self.latest(module, self.last_changed) |
|
194 | brevnum = self.latest(module, self.last_changed) | |
191 | brev = self.revid(brevnum, module) |
|
195 | brev = self.revid(brevnum, module) | |
192 | self.ui.note('found branch %s at %d\n' % (branch, brevnum)) |
|
196 | self.ui.note('found branch %s at %d\n' % (branch, brevnum)) | |
193 | self.heads.append(brev) |
|
197 | self.heads.append(brev) | |
194 | elif cfgtrunk or cfgbranches: |
|
198 | ||
195 | raise util.Abort('trunk/branch layout expected, but not found') |
|
199 | if oldmodule: | |
|
200 | self.tags = '%s/%s' % (oldmodule, tags) | |||
|
201 | else: | |||
|
202 | self.tags = '/%s' % tags | |||
|
203 | ||||
|
204 | elif cfgtrunk or cfgbranches or cfgtags: | |||
|
205 | raise util.Abort('trunk/branch/tags layout expected, but not found') | |||
196 | else: |
|
206 | else: | |
197 | self.ui.note('working with one branch\n') |
|
207 | self.ui.note('working with one branch\n') | |
198 | self.heads = [self.head] |
|
208 | self.heads = [self.head] | |
|
209 | self.tags = tags | |||
199 | return self.heads |
|
210 | return self.heads | |
200 |
|
211 | |||
201 | def getfile(self, file, rev): |
|
212 | def getfile(self, file, rev): | |
@@ -268,15 +279,15 b' class svn_source(converter_source):' | |||||
268 | tags = {} |
|
279 | tags = {} | |
269 | start = self.revnum(self.head) |
|
280 | start = self.revnum(self.head) | |
270 | try: |
|
281 | try: | |
271 |
for entry in self.get_log([ |
|
282 | for entry in self.get_log([self.tags], 0, start): | |
272 | orig_paths, revnum, author, date, message = entry |
|
283 | orig_paths, revnum, author, date, message = entry | |
273 | for path in orig_paths: |
|
284 | for path in orig_paths: | |
274 |
if not path.startswith('/ |
|
285 | if not path.startswith(self.tags+'/'): | |
275 | continue |
|
286 | continue | |
276 | ent = orig_paths[path] |
|
287 | ent = orig_paths[path] | |
277 | source = ent.copyfrom_path |
|
288 | source = ent.copyfrom_path | |
278 | rev = ent.copyfrom_rev |
|
289 | rev = ent.copyfrom_rev | |
279 |
tag = path.split('/' |
|
290 | tag = path.split('/')[-1] | |
280 | tags[tag] = self.revid(rev, module=source) |
|
291 | tags[tag] = self.revid(rev, module=source) | |
281 | except SubversionException, (inst, num): |
|
292 | except SubversionException, (inst, num): | |
282 | self.ui.note('no tags found at revision %d\n' % start) |
|
293 | self.ui.note('no tags found at revision %d\n' % start) |
@@ -58,3 +58,58 b" echo '[extensions]' >> $HGRCPATH" | |||||
58 | echo 'hgext.graphlog =' >> $HGRCPATH |
|
58 | echo 'hgext.graphlog =' >> $HGRCPATH | |
59 | hg glog -R fmap --template '#rev# #desc|firstline# files: #files#\n' |
|
59 | hg glog -R fmap --template '#rev# #desc|firstline# files: #files#\n' | |
60 |
|
60 | |||
|
61 | ######################################## | |||
|
62 | ||||
|
63 | echo "# now tests that it works with trunk/branches/tags layout" | |||
|
64 | echo | |||
|
65 | echo % initial svn import | |||
|
66 | mkdir projA | |||
|
67 | cd projA | |||
|
68 | mkdir trunk | |||
|
69 | mkdir branches | |||
|
70 | mkdir tags | |||
|
71 | cd .. | |||
|
72 | ||||
|
73 | svnurl=file://$svnpath/svn-repo/projA | |||
|
74 | svn import -m "init projA" projA $svnurl | fix_path | |||
|
75 | ||||
|
76 | ||||
|
77 | echo % update svn repository | |||
|
78 | svn co $svnurl/trunk A | fix_path | |||
|
79 | cd A | |||
|
80 | echo hello > letter.txt | |||
|
81 | svn add letter.txt | |||
|
82 | svn ci -m hello | |||
|
83 | ||||
|
84 | echo world >> letter.txt | |||
|
85 | svn ci -m world | |||
|
86 | ||||
|
87 | svn copy -m "tag v0.1" $svnurl/trunk $svnurl/tags/v0.1 | |||
|
88 | ||||
|
89 | echo 'nice day today!' >> letter.txt | |||
|
90 | svn ci -m "nice day" | |||
|
91 | cd .. | |||
|
92 | ||||
|
93 | echo % convert to hg once | |||
|
94 | hg convert $svnurl A-hg | |||
|
95 | ||||
|
96 | echo % update svn repository again | |||
|
97 | cd A | |||
|
98 | echo "see second letter" >> letter.txt | |||
|
99 | echo "nice to meet you" > letter2.txt | |||
|
100 | svn add letter2.txt | |||
|
101 | svn ci -m "second letter" | |||
|
102 | ||||
|
103 | svn copy -m "tag v0.2" $svnurl/trunk $svnurl/tags/v0.2 | |||
|
104 | ||||
|
105 | echo "blah-blah-blah" >> letter2.txt | |||
|
106 | svn ci -m "work in progress" | |||
|
107 | cd .. | |||
|
108 | ||||
|
109 | echo % test incremental conversion | |||
|
110 | hg convert $svnurl A-hg | |||
|
111 | ||||
|
112 | cd A-hg | |||
|
113 | hg glog --template '#rev# #desc|firstline# files: #files#\n' | |||
|
114 | hg tags -q | |||
|
115 | cd .. |
@@ -42,3 +42,73 b' o 1 changeb files: b' | |||||
42 | | |
|
42 | | | |
43 | o 0 changea files: b |
|
43 | o 0 changea files: b | |
44 |
|
44 | |||
|
45 | # now tests that it works with trunk/branches/tags layout | |||
|
46 | ||||
|
47 | % initial svn import | |||
|
48 | Adding projA/trunk | |||
|
49 | Adding projA/branches | |||
|
50 | Adding projA/tags | |||
|
51 | ||||
|
52 | Committed revision 4. | |||
|
53 | % update svn repository | |||
|
54 | Checked out revision 4. | |||
|
55 | A letter.txt | |||
|
56 | Adding letter.txt | |||
|
57 | Transmitting file data . | |||
|
58 | Committed revision 5. | |||
|
59 | Sending letter.txt | |||
|
60 | Transmitting file data . | |||
|
61 | Committed revision 6. | |||
|
62 | ||||
|
63 | Committed revision 7. | |||
|
64 | Sending letter.txt | |||
|
65 | Transmitting file data . | |||
|
66 | Committed revision 8. | |||
|
67 | % convert to hg once | |||
|
68 | initializing destination A-hg repository | |||
|
69 | scanning source... | |||
|
70 | sorting... | |||
|
71 | converting... | |||
|
72 | 3 init projA | |||
|
73 | 2 hello | |||
|
74 | 1 world | |||
|
75 | 0 nice day | |||
|
76 | updating tags | |||
|
77 | % update svn repository again | |||
|
78 | A letter2.txt | |||
|
79 | Sending letter.txt | |||
|
80 | Adding letter2.txt | |||
|
81 | Transmitting file data .. | |||
|
82 | Committed revision 9. | |||
|
83 | ||||
|
84 | Committed revision 10. | |||
|
85 | Sending letter2.txt | |||
|
86 | Transmitting file data . | |||
|
87 | Committed revision 11. | |||
|
88 | % test incremental conversion | |||
|
89 | destination A-hg is a Mercurial repository | |||
|
90 | scanning source... | |||
|
91 | sorting... | |||
|
92 | converting... | |||
|
93 | 1 second letter | |||
|
94 | 0 work in progress | |||
|
95 | updating tags | |||
|
96 | o 7 update tags files: .hgtags | |||
|
97 | | | |||
|
98 | o 6 work in progress files: letter2.txt | |||
|
99 | | | |||
|
100 | o 5 second letter files: letter.txt letter2.txt | |||
|
101 | | | |||
|
102 | o 4 update tags files: .hgtags | |||
|
103 | | | |||
|
104 | o 3 nice day files: letter.txt | |||
|
105 | | | |||
|
106 | o 2 world files: letter.txt | |||
|
107 | | | |||
|
108 | o 1 hello files: letter.txt | |||
|
109 | | | |||
|
110 | o 0 init projA files: | |||
|
111 | ||||
|
112 | tip | |||
|
113 | v0.2 | |||
|
114 | v0.1 |
General Comments 0
You need to be logged in to leave comments.
Login now