731
_global_option('max-count', type = int)
732
class cmd_baz_import_branch(Command):
733
"""Import an Arch or Baz branch into a bzr branch. <BZRTOOLS>"""
734
takes_args = ['to_location', 'from_branch?', 'reuse_history*']
735
takes_options = ['verbose', 'max-count']
725
def baz_import_branch(to_location, from_branch, fast, max_count, verbose,
726
dry_run, reuse_history_list):
727
to_location = os.path.realpath(str(to_location))
728
if from_branch is not None:
730
from_branch = pybaz.Version(from_branch)
731
except pybaz.errors.NamespaceError:
732
print "%s is not a valid Arch branch." % from_branch
734
if reuse_history_list is None:
735
reuse_history_list = []
736
import_version(to_location, from_branch,
738
reuse_history_from=reuse_history_list)
737
def run(self, to_location, from_branch=None, fast=False, max_count=None,
738
verbose=False, dry_run=False, reuse_history_list=[]):
739
to_location = os.path.realpath(str(to_location))
740
if from_branch is not None:
742
from_branch = pybaz.Version(from_branch)
743
except pybaz.errors.NamespaceError:
744
print "%s is not a valid Arch branch." % from_branch
746
if reuse_history_list is None:
747
reuse_history_list = []
748
import_version(to_location, from_branch,
750
reuse_history_from=reuse_history_list)
741
753
class NotInABranch(Exception):
748
def baz_import(to_root_dir, from_archive, verbose=False, reuse_history_list=[],
750
if reuse_history_list is None:
751
reuse_history_list = []
752
to_root = str(os.path.realpath(to_root_dir))
753
if not os.path.exists(to_root):
755
if prefixes is not None:
756
prefixes = prefixes.split(':')
757
import_archive(to_root, from_archive, verbose,
758
reuse_history_list, prefixes=prefixes)
759
class cmd_baz_import(Command):
760
"""Import an Arch or Baz archive into a bzr repository. <BZRTOOLS>
762
This command should be used on local archives (or mirrors) only. It is
763
quite slow on remote archives.
765
reuse_history allows you to specify any previous imports you
766
have done of different archives, which this archive has branches
767
tagged from. This will dramatically reduce the time to convert
768
the archive as it will not have to convert the history already
769
converted in that other branch.
771
If you specify prefixes, only branches whose names start with that prefix
772
will be imported. Skipped branches will be listed, so you can import any
773
branches you missed by accident. Here's an example of doing a partial
774
import from thelove@canonical.com:
775
bzr baz-import thelove thelove@canonical.com --prefixes dists:talloc-except
777
takes_args = ['to_root_dir', 'from_archive', 'reuse_history*']
778
takes_options = ['verbose', Option('prefixes', type=str,
779
help="Prefixes of branches to import, colon-separated")]
781
def run(self, to_root_dir, from_archive, verbose=False,
782
reuse_history_list=[], prefixes=None):
783
if reuse_history_list is None:
784
reuse_history_list = []
785
to_root = str(os.path.realpath(to_root_dir))
786
if not os.path.exists(to_root):
788
if prefixes is not None:
789
prefixes = prefixes.split(':')
790
import_archive(to_root, from_archive, verbose,
791
reuse_history_list, prefixes=prefixes)
761
794
def import_archive(to_root, from_archive, verbose,