20 converters = [convert_cvs, convert_git, convert_svn, mercurial_source, |
20 converters = [convert_cvs, convert_git, convert_svn, mercurial_source, |
21 mercurial_sink] |
21 mercurial_sink] |
22 |
22 |
23 def convertsource(ui, path, **opts): |
23 def convertsource(ui, path, **opts): |
24 for c in converters: |
24 for c in converters: |
25 if not hasattr(c, 'getcommit'): |
|
26 continue |
|
27 try: |
25 try: |
28 return c(ui, path, **opts) |
26 return c.getcommit and c(ui, path, **opts) |
29 except NoRepo: |
27 except (AttributeError, NoRepo): |
30 pass |
28 pass |
31 raise util.Abort('%s: unknown repository type' % path) |
29 raise util.Abort('%s: unknown repository type' % path) |
32 |
30 |
33 def convertsink(ui, path): |
31 def convertsink(ui, path): |
34 if not os.path.isdir(path): |
32 if not os.path.isdir(path): |
35 raise util.Abort("%s: not a directory" % path) |
33 raise util.Abort("%s: not a directory" % path) |
36 for c in converters: |
34 for c in converters: |
37 if not hasattr(c, 'putcommit'): |
|
38 continue |
|
39 try: |
35 try: |
40 return c(ui, path) |
36 return c.putcommit and c(ui, path) |
41 except NoRepo: |
37 except (AttributeError, NoRepo): |
42 pass |
38 pass |
43 raise util.Abort('%s: unknown repository type' % path) |
39 raise util.Abort('%s: unknown repository type' % path) |
44 |
40 |
45 class convert(object): |
41 class convert(object): |
46 def __init__(self, ui, source, dest, revmapfile, filemapper, opts): |
42 def __init__(self, ui, source, dest, revmapfile, filemapper, opts): |