# HG changeset patch # User Greg Ward # Date 1238706962 14400 # Node ID f6f0fd01b34aed1c9ebb1c92f5557502f45cca7d # Parent 9c7d88b94b088b3d68011d197369f70ad88e0d4a Preliminary support for reading multiple input files. diff -r 9c7d88b94b08 -r f6f0fd01b34a fastimport/__init__.py --- a/fastimport/__init__.py Thu Apr 02 17:14:03 2009 -0400 +++ b/fastimport/__init__.py Thu Apr 02 17:16:02 2009 -0400 @@ -4,17 +4,23 @@ import hgechoprocessor import hgimport -def fastimport(ui, repo, source, **opts): - ui.write("Source is %s\n" % source) - f = open(source) +def fastimport(ui, repo, *sources, **opts): proc = hgimport.HgImportProcessor(ui, repo, **opts) #proc = hgechoprocessor.HgEchoProcessor(ui, repo, **opts) - p = parser.ImportParser(f) - proc.process(p.iter_commands) + 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') + 'hg fastimport SOURCE ...') } diff -r 9c7d88b94b08 -r f6f0fd01b34a fastimport/processor.py --- a/fastimport/processor.py Thu Apr 02 17:14:03 2009 -0400 +++ b/fastimport/processor.py Thu Apr 02 17:16:02 2009 -0400 @@ -32,11 +32,14 @@ methods as appropriate. """ + # XXX this is useless now that we process multiple input streams: + # we only want to call setup() and teardown() once for all of them! def process(self, command_iter): """Process the stream of commands. :param command_iter: an iterator providing commands """ + raise RuntimeError("hey! who's calling this?!?") self.setup() try: self._process(command_iter)