view hgfastimport/__init__.py @ 34:08e2157aaa9a

Remove local fork of bzr-fastimport; use my fastimport library instead.
author Greg Ward <greg-hg@gerg.ca>
date Tue, 05 May 2009 11:28:53 -0400
parents 31b9a5805f02
children 7ff36dc9f0b1
line wrap: on
line source

from mercurial import commands

from fastimport import parser
import hgechoprocessor
import hgimport

def fastimport(ui, repo, *sources, **opts):
    proc = hgimport.HgImportProcessor(ui, repo, **opts)
    #proc = hgechoprocessor.HgEchoProcessor(ui, repo, **opts)
    proc.setup()
    try:
        for source in sources:
            ui.write("Reading source: %s\n" % source)
            f = open(source)
            p = parser.ImportParser(f)
            proc.process(p.iter_commands)
            f.close()
    finally:
        proc.teardown()

cmdtable = {
    "fastimport":
        (fastimport,
         [],
         'hg fastimport SOURCE ...')
}