def setUp(self): super(GitImportProcessorTests, self).setUp() self.repo = MemoryRepo() try: from dulwich.fastexport import GitImportProcessor except ImportError: raise SkipTest("python-fastimport not available") self.processor = GitImportProcessor(self.repo)
def finish(self): """We are finished building, close the stream, get the id mapping""" self.stream.seek(0) if self.orig_stream is None: from dulwich.repo import Repo r = Repo(".") from dulwich.fastexport import GitImportProcessor importer = GitImportProcessor(r) return importer.import_stream(self.stream)
#!/usr/bin/python """ A simple test script that calls GitImportProcessor on sys.stdin. """ import sys from dulwich.repo import Repo from dulwich.fastexport import GitImportProcessor from tempfile import mkdtemp if __name__ == "__main__": nr = Repo.init(mkdtemp()) fi = GitImportProcessor(nr) fi.import_stream(sys.stdin) exit(0)