##// END OF EJS Templates
convert/svn: remove useless try/catch...
Patrick Mezard -
r11194:67985364 stable
parent child Browse files
Show More
@@ -448,79 +448,76 b' class svn_source(converter_source):'
448 pendings = []
448 pendings = []
449 tagspath = self.tags
449 tagspath = self.tags
450 start = svn.ra.get_latest_revnum(self.ra)
450 start = svn.ra.get_latest_revnum(self.ra)
451 try:
451 for entry in self._getlog([self.tags], start, self.startrev):
452 for entry in self._getlog([self.tags], start, self.startrev):
452 origpaths, revnum, author, date, message = entry
453 origpaths, revnum, author, date, message = entry
453 copies = [(e.copyfrom_path, e.copyfrom_rev, p) for p, e
454 copies = [(e.copyfrom_path, e.copyfrom_rev, p) for p, e
454 in origpaths.iteritems() if e.copyfrom_path]
455 in origpaths.iteritems() if e.copyfrom_path]
455 # Apply moves/copies from more specific to general
456 # Apply moves/copies from more specific to general
456 copies.sort(reverse=True)
457 copies.sort(reverse=True)
458
457
459 srctagspath = tagspath
458 srctagspath = tagspath
460 if copies and copies[-1][2] == tagspath:
459 if copies and copies[-1][2] == tagspath:
461 # Track tags directory moves
460 # Track tags directory moves
462 srctagspath = copies.pop()[0]
461 srctagspath = copies.pop()[0]
463
462
464 for source, sourcerev, dest in copies:
463 for source, sourcerev, dest in copies:
465 if not dest.startswith(tagspath + '/'):
464 if not dest.startswith(tagspath + '/'):
466 continue
465 continue
467 for tag in pendings:
466 for tag in pendings:
468 if tag[0].startswith(dest):
467 if tag[0].startswith(dest):
469 tagpath = source + tag[0][len(dest):]
468 tagpath = source + tag[0][len(dest):]
470 tag[:2] = [tagpath, sourcerev]
469 tag[:2] = [tagpath, sourcerev]
471 break
470 break
472 else:
471 else:
473 pendings.append([source, sourcerev, dest])
472 pendings.append([source, sourcerev, dest])
474
473
475 # Filter out tags with children coming from different
474 # Filter out tags with children coming from different
476 # parts of the repository like:
475 # parts of the repository like:
477 # /tags/tag.1 (from /trunk:10)
476 # /tags/tag.1 (from /trunk:10)
478 # /tags/tag.1/foo (from /branches/foo:12)
477 # /tags/tag.1/foo (from /branches/foo:12)
479 # Here/tags/tag.1 discarded as well as its children.
478 # Here/tags/tag.1 discarded as well as its children.
480 # It happens with tools like cvs2svn. Such tags cannot
479 # It happens with tools like cvs2svn. Such tags cannot
481 # be represented in mercurial.
480 # be represented in mercurial.
482 addeds = dict((p, e.copyfrom_path) for p, e
481 addeds = dict((p, e.copyfrom_path) for p, e
483 in origpaths.iteritems()
482 in origpaths.iteritems()
484 if e.action == 'A' and e.copyfrom_path)
483 if e.action == 'A' and e.copyfrom_path)
485 badroots = set()
484 badroots = set()
486 for destroot in addeds:
485 for destroot in addeds:
487 for source, sourcerev, dest in pendings:
486 for source, sourcerev, dest in pendings:
488 if (not dest.startswith(destroot + '/')
487 if (not dest.startswith(destroot + '/')
489 or source.startswith(addeds[destroot] + '/')):
488 or source.startswith(addeds[destroot] + '/')):
490 continue
489 continue
491 badroots.add(destroot)
490 badroots.add(destroot)
492 break
491 break
493
492
494 for badroot in badroots:
493 for badroot in badroots:
495 pendings = [p for p in pendings if p[2] != badroot
494 pendings = [p for p in pendings if p[2] != badroot
496 and not p[2].startswith(badroot + '/')]
495 and not p[2].startswith(badroot + '/')]
497
496
498 # Tell tag renamings from tag creations
497 # Tell tag renamings from tag creations
499 remainings = []
498 remainings = []
500 for source, sourcerev, dest in pendings:
499 for source, sourcerev, dest in pendings:
501 tagname = dest.split('/')[-1]
500 tagname = dest.split('/')[-1]
502 if source.startswith(srctagspath):
501 if source.startswith(srctagspath):
503 remainings.append([source, sourcerev, tagname])
502 remainings.append([source, sourcerev, tagname])
504 continue
503 continue
505 if tagname in tags:
504 if tagname in tags:
506 # Keep the latest tag value
505 # Keep the latest tag value
507 continue
506 continue
508 # From revision may be fake, get one with changes
507 # From revision may be fake, get one with changes
509 try:
508 try:
510 tagid = self.latest(source, sourcerev)
509 tagid = self.latest(source, sourcerev)
511 if tagid and tagname not in tags:
510 if tagid and tagname not in tags:
512 tags[tagname] = tagid
511 tags[tagname] = tagid
513 except SvnPathNotFound:
512 except SvnPathNotFound:
514 # It happens when we are following directories
513 # It happens when we are following directories
515 # we assumed were copied with their parents
514 # we assumed were copied with their parents
516 # but were really created in the tag
515 # but were really created in the tag
517 # directory.
516 # directory.
518 pass
517 pass
519 pendings = remainings
518 pendings = remainings
520 tagspath = srctagspath
519 tagspath = srctagspath
521
520
522 except SubversionException:
523 self.ui.note(_('no tags found at revision %d\n') % start)
524 return tags
521 return tags
525
522
526 def converted(self, rev, destrev):
523 def converted(self, rev, destrev):
@@ -1,6 +1,6 b''
1 SVN-fs-dump-format-version: 2
1 SVN-fs-dump-format-version: 2
2
2
3 UUID: 3c3c228a-b3dd-467c-a766-896f4b7cd0af
3 UUID: 9ccdebd5-40da-43b4-a9c9-c2857851ccaf
4
4
5 Revision-number: 0
5 Revision-number: 0
6 Prop-content-length: 56
6 Prop-content-length: 56
@@ -9,7 +9,7 b' Content-length: 56'
9 K 8
9 K 8
10 svn:date
10 svn:date
11 V 27
11 V 27
12 2009-06-21T12:38:53.023457Z
12 2010-05-19T19:36:21.767874Z
13 PROPS-END
13 PROPS-END
14
14
15 Revision-number: 1
15 Revision-number: 1
@@ -27,7 +27,7 b' pmezard'
27 K 8
27 K 8
28 svn:date
28 svn:date
29 V 27
29 V 27
30 2009-06-21T12:38:53.111986Z
30 2010-05-19T19:36:21.795557Z
31 PROPS-END
31 PROPS-END
32
32
33 Node-path: branches
33 Node-path: branches
@@ -39,15 +39,6 b' Content-length: 10'
39 PROPS-END
39 PROPS-END
40
40
41
41
42 Node-path: tags
43 Node-kind: dir
44 Node-action: add
45 Prop-content-length: 10
46 Content-length: 10
47
48 PROPS-END
49
50
51 Node-path: trunk
42 Node-path: trunk
52 Node-kind: dir
43 Node-kind: dir
53 Node-action: add
44 Node-action: add
@@ -72,7 +63,7 b' pmezard'
72 K 8
63 K 8
73 svn:date
64 svn:date
74 V 27
65 V 27
75 2009-06-21T12:38:54.182594Z
66 2010-05-19T19:36:22.069417Z
76 PROPS-END
67 PROPS-END
77
68
78 Node-path: branches/notinbranch
69 Node-path: branches/notinbranch
@@ -164,7 +155,7 b' pmezard'
164 K 8
155 K 8
165 svn:date
156 svn:date
166 V 27
157 V 27
167 2009-06-21T12:38:57.166484Z
158 2010-05-19T19:36:25.067407Z
168 PROPS-END
159 PROPS-END
169
160
170 Node-path: branches/old
161 Node-path: branches/old
@@ -197,7 +188,7 b' pmezard'
197 K 8
188 K 8
198 svn:date
189 svn:date
199 V 27
190 V 27
200 2009-06-21T12:38:59.084420Z
191 2010-05-19T19:36:27.042834Z
201 PROPS-END
192 PROPS-END
202
193
203 Node-path: trunk/a
194 Node-path: trunk/a
@@ -227,7 +218,7 b' pmezard'
227 K 8
218 K 8
228 svn:date
219 svn:date
229 V 27
220 V 27
230 2009-06-21T12:39:00.093201Z
221 2010-05-19T19:36:28.045031Z
231 PROPS-END
222 PROPS-END
232
223
233 Node-path: branches/old/b
224 Node-path: branches/old/b
@@ -257,7 +248,7 b' pmezard'
257 K 8
248 K 8
258 svn:date
249 svn:date
259 V 27
250 V 27
260 2009-06-21T12:39:02.078633Z
251 2010-05-19T19:36:30.049884Z
261 PROPS-END
252 PROPS-END
262
253
263 Node-path: branches/old/c
254 Node-path: branches/old/c
@@ -295,7 +286,7 b' pmezard'
295 K 8
286 K 8
296 svn:date
287 svn:date
297 V 27
288 V 27
298 2009-06-21T12:39:03.065537Z
289 2010-05-19T19:36:31.044711Z
299 PROPS-END
290 PROPS-END
300
291
301 Node-path: branches/old/b
292 Node-path: branches/old/b
@@ -326,7 +317,7 b' pmezard'
326 K 8
317 K 8
327 svn:date
318 svn:date
328 V 27
319 V 27
329 2009-06-21T12:39:06.070275Z
320 2010-05-19T19:36:34.043552Z
330 PROPS-END
321 PROPS-END
331
322
332 Node-path: branches/old2
323 Node-path: branches/old2
@@ -355,7 +346,7 b' pmezard'
355 K 8
346 K 8
356 svn:date
347 svn:date
357 V 27
348 V 27
358 2009-06-21T12:39:08.082539Z
349 2010-05-19T19:36:36.042680Z
359 PROPS-END
350 PROPS-END
360
351
361 Node-path: branches/old
352 Node-path: branches/old
@@ -384,7 +375,7 b' pmezard'
384 K 8
375 K 8
385 svn:date
376 svn:date
386 V 27
377 V 27
387 2009-06-21T12:39:09.073290Z
378 2010-05-19T19:36:37.043714Z
388 PROPS-END
379 PROPS-END
389
380
390 Node-path: trunk/a
381 Node-path: trunk/a
@@ -413,7 +404,7 b' pmezard'
413 K 8
404 K 8
414 svn:date
405 svn:date
415 V 27
406 V 27
416 2009-06-21T12:39:11.070264Z
407 2010-05-19T19:36:39.044703Z
417 PROPS-END
408 PROPS-END
418
409
419 Node-path: branches/old3
410 Node-path: branches/old3
@@ -10,7 +10,6 b' mkdir project-orig'
10 cd project-orig
10 cd project-orig
11 mkdir trunk
11 mkdir trunk
12 mkdir branches
12 mkdir branches
13 mkdir tags
14 cd ..
13 cd ..
15
14
16 svnadmin create svn-repo
15 svnadmin create svn-repo
General Comments 0
You need to be logged in to leave comments. Login now