hgext/convert/__init__.py
changeset 5414 eb58722d282f
parent 5378 8a2915f57dfc
child 5415 1d53a75ea0fc
equal deleted inserted replaced
5413:719fd175181f 5414:eb58722d282f
    17 from mercurial import hg, ui, util, commands
    17 from mercurial import hg, ui, util, commands
    18 from mercurial.i18n import _
    18 from mercurial.i18n import _
    19 
    19 
    20 commands.norepo += " convert debugsvnlog"
    20 commands.norepo += " convert debugsvnlog"
    21 
    21 
    22 converters = [convert_cvs, convert_git, convert_svn, mercurial_source,
    22 sink_converters = [mercurial_sink]
    23               mercurial_sink, darcs_source]
    23 source_converters = [convert_cvs, convert_git, convert_svn,
    24 
    24                      mercurial_source, darcs_source]
    25 def convertsource(ui, path, **opts):
    25 def convertsource(ui, path, **opts):
    26     for c in converters:
    26     for c in source_converters:
    27         try:
    27         try:
    28             return c.getcommit and c(ui, path, **opts)
    28             return c.getcommit and c(ui, path, **opts)
    29         except (AttributeError, NoRepo):
    29         except (AttributeError, NoRepo):
    30             pass
    30             pass
    31     raise util.Abort('%s: unknown repository type' % path)
    31     raise util.Abort('%s: unknown repository type' % path)
    32 
    32 
    33 def convertsink(ui, path):
    33 def convertsink(ui, path):
    34     if not os.path.isdir(path):
    34     if not os.path.isdir(path):
    35         raise util.Abort("%s: not a directory" % path)
    35         raise util.Abort("%s: not a directory" % path)
    36     for c in converters:
    36     for c in sink_converters:
    37         try:
    37         try:
    38             return c.putcommit and c(ui, path)
    38             return c.putcommit and c(ui, path)
    39         except (AttributeError, NoRepo):
    39         except (AttributeError, NoRepo):
    40             pass
    40             pass
    41     raise util.Abort('%s: unknown repository type' % path)
    41     raise util.Abort('%s: unknown repository type' % path)