~lifeless/bzrtools/trunk

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Robert Collins
  • Date: 2008-07-08 04:11:21 UTC
  • mfrom: (623.1.33 bzrtools)
  • Revision ID: robertc@robertcollins.net-20080708041121-lo0k7os2y03uclt2
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
from version import version_info, __version__
32
32
from command import BzrToolsCommand
33
 
from errors import CommandError, NoPyBaz
 
33
from errors import CommandError
34
34
from patchsource import BzrPatchSource
35
35
import sys
36
36
import os.path
44
44
import bzrlib.ignores
45
45
from bzrlib.trace import note
46
46
from bzrlib.option import Option
47
 
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__),
48
 
                                                 "external")))
49
47
 
50
 
import show_paths
51
48
from command import BzrToolsCommand
52
49
 
53
50
bzrlib.ignores.add_runtime_ignores(['./.shelf'])
587
584
        colordiff(check_style, *args, **kwargs)
588
585
 
589
586
 
590
 
class cmd_baz_import(BzrToolsCommand):
591
 
    """Import an Arch or Baz archive into a bzr repository.
592
 
 
593
 
    This command should be used on local archives (or mirrors) only.  It is
594
 
    quite slow on remote archives.
595
 
 
596
 
    reuse_history allows you to specify any previous imports you
597
 
    have done of different archives, which this archive has branches
598
 
    tagged from. This will dramatically reduce the time to convert
599
 
    the archive as it will not have to convert the history already
600
 
    converted in that other branch.
601
 
 
602
 
    If you specify prefixes, only branches whose names start with that prefix
603
 
    will be imported.  Skipped branches will be listed, so you can import any
604
 
    branches you missed by accident.  Here's an example of doing a partial
605
 
    import from thelove@canonical.com:
606
 
    bzr baz-import thelove thelove@canonical.com --prefixes dists:talloc-except
607
 
 
608
 
    WARNING: Encoding should not be specified unless necessary, because if you
609
 
    specify an encoding, your converted branch will not interoperate with
610
 
    independently-converted branches, unless the other branches were converted
611
 
    with exactly the same encoding.  Any encoding recognized by Python may
612
 
    be specified.  Aliases are not detected, so 'utf_8', 'U8', 'UTF' and 'utf8'
613
 
    are incompatible.
614
 
    """
615
 
    takes_args = ['to_root_dir', 'from_archive', 'reuse_history*']
616
 
    takes_options = ['verbose', Option('prefixes', type=str,
617
 
                     help="Prefixes of branches to import, colon-separated."),
618
 
                     Option('encoding', type=str,
619
 
                     help='Force encoding to specified value.  See WARNING.')]
620
 
 
621
 
    def run(self, to_root_dir, from_archive, encoding=None, verbose=False,
622
 
            reuse_history_list=[], prefixes=None):
623
 
        from errors import NoPyBaz
624
 
        try:
625
 
            import baz_import
626
 
            baz_import.baz_import(to_root_dir, from_archive, encoding,
627
 
                                  verbose, reuse_history_list, prefixes)
628
 
        except NoPyBaz:
629
 
            print "This command is disabled.  Please install PyBaz."
630
 
 
631
 
 
632
 
class cmd_baz_import_branch(BzrToolsCommand):
633
 
    """Import an Arch or Baz branch into a bzr branch.
634
 
 
635
 
    WARNING: Encoding should not be specified unless necessary, because if you
636
 
    specify an encoding, your converted branch will not interoperate with
637
 
    independently-converted branches, unless the other branches were converted
638
 
    with exactly the same encoding.  Any encoding recognized by Python may
639
 
    be specified.  Aliases are not detected, so 'utf_8', 'U8', 'UTF' and 'utf8'
640
 
    are incompatible.
641
 
    """
642
 
    takes_args = ['to_location', 'from_branch?', 'reuse_history*']
643
 
    takes_options = ['verbose', 
644
 
                     Option('max-count', type=int, 
645
 
                     help='Maximim revisions to import at once.'),
646
 
                     Option('encoding', type=str,
647
 
                     help='Force encoding to specified value.  See WARNING.')]
648
 
 
649
 
    def run(self, to_location, from_branch=None, fast=False, max_count=None,
650
 
            encoding=None, verbose=False, dry_run=False,
651
 
            reuse_history_list=[]):
652
 
        from errors import NoPyBaz
653
 
        try:
654
 
            import baz_import
655
 
            baz_import.baz_import_branch(to_location, from_branch, fast,
656
 
                                         max_count, verbose, encoding, dry_run,
657
 
                                         reuse_history_list)
658
 
        except NoPyBaz:
659
 
            print "This command is disabled.  Please install PyBaz."
660
 
 
661
 
 
662
587
class cmd_rspush(BzrToolsCommand):
663
588
    """Upload this branch to another location using rsync.
664
589
 
703
628
        finally:
704
629
            target_tree.unlock()
705
630
 
706
 
 
 
631
from heads import cmd_heads
707
632
commands = [
708
 
            cmd_baz_import,
709
 
            cmd_baz_import_branch,
710
633
            cmd_branches,
711
 
            cmd_trees,
712
634
            cmd_branch_history,
713
635
            cmd_cbranch,
714
636
            cmd_cdiff,
715
637
            cmd_clean_tree,
716
638
            cmd_fetch_ghosts,
717
639
            cmd_graph_ancestry,
 
640
            cmd_heads,
718
641
            cmd_import,
719
642
            cmd_link_tree,
720
643
            cmd_multi_pull,
723
646
            cmd_shelf,
724
647
            cmd_shell,
725
648
            cmd_shelve,
 
649
            cmd_trees,
726
650
            cmd_unshelve,
727
651
            cmd_zap,
728
652
            ]
740
664
    from unittest import TestSuite
741
665
    import bzrtools
742
666
    import tests.clean_tree
 
667
    import tests.test_dotgraph
743
668
    import tests.is_clean
 
669
    import tests.test_cbranch
744
670
    import tests.test_link_tree
745
671
    import tests.test_patch
746
672
    import tests.test_rspush
751
677
    result = TestSuite()
752
678
    result.addTest(DocTestSuite(bzrtools, optionflags=ELLIPSIS))
753
679
    result.addTest(tests.clean_tree.test_suite())
754
 
    try:
755
 
        import baz_import
756
 
        result.addTest(DocTestSuite(baz_import))
757
 
    except NoPyBaz:
758
 
        pass
759
680
    result.addTest(tests.test_suite())
760
681
    result.addTest(TestLoader().loadTestsFromModule(tests.shelf_tests))
761
682
    result.addTest(tests.blackbox.test_suite())
762
683
    result.addTest(tests.upstream_import.test_suite())
763
684
    result.addTest(zap.test_suite())
 
685
    result.addTest(TestLoader().loadTestsFromModule(tests.test_dotgraph))
764
686
    result.addTest(TestLoader().loadTestsFromModule(tests.is_clean))
765
687
    result.addTest(TestLoader().loadTestsFromModule(tests.test_link_tree))
766
688
    result.addTest(TestLoader().loadTestsFromModule(tests.test_patch))
767
689
    result.addTest(TestLoader().loadTestsFromModule(tests.test_rspush))
 
690
    result.addTest(TestLoader().loadTestsFromModule(tests.test_cbranch))
768
691
    return result