1# Copyright (C) 2008-2011 Canonical Ltd 2# 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 2 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16r"""FastImport Plugin 17================= 18 19The fastimport plugin provides stream-based importing and exporting of 20data into and out of Bazaar. As well as enabling interchange between 21multiple VCS tools, fastimport/export can be useful for complex branch 22operations, e.g. partitioning off part of a code base in order to Open 23Source it. 24 25The normal import recipe is:: 26 27 front-end > project.fi 28 bzr fast-import project.fi project.bzr 29 30In either case, if you wish to save disk space, project.fi can be 31compressed to gzip format after it is generated like this:: 32 33 (generate project.fi) 34 gzip project.fi 35 bzr fast-import project.fi.gz project.bzr 36 37The list of known front-ends and their status is documented on 38http://bazaar-vcs.org/BzrFastImport/FrontEnds. 39 40Once a fast-import dump file is created, it can be imported into a 41Bazaar repository using the fast-import command. If required, you can 42manipulate the stream first using the fast-import-filter command. 43This is useful for creating a repository with just part of a project 44or for removing large old binaries (say) from history that are no longer 45valuable to retain. For further details on importing, manipulating and 46reporting on fast-import streams, see the online help for the commands:: 47 48 bzr help fast-import 49 50Finally, you may wish to generate a fast-import dump file from a Bazaar 51repository. The fast-export command is provided for that purpose. 52 53To report bugs or publish enhancements, visit the bzr-fastimport project 54page on Launchpad, https://launchpad.net/bzr-fastimport. 55""" 56 57from ... import version_info # noqa: F401 58from ...commands import plugin_cmds 59 60 61def load_fastimport(): 62 """Load the fastimport module or raise an appropriate exception.""" 63 try: 64 import fastimport 65 except ImportError as e: 66 from ...errors import DependencyNotPresent 67 raise DependencyNotPresent("fastimport", 68 "fastimport requires the fastimport python module") 69 if fastimport.__version__ < (0, 9, 8): 70 from ...errors import DependencyNotPresent 71 raise DependencyNotPresent("fastimport", 72 "fastimport requires at least version 0.9.8 of the " 73 "fastimport python module") 74 75 76def test_suite(): 77 from . import tests 78 return tests.test_suite() 79 80 81for name in [ 82 "fast_import", 83 "fast_export", 84 ]: 85 plugin_cmds.register_lazy( 86 "cmd_%s" % name, [], "breezy.plugins.fastimport.cmds") 87