~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Aaron Bentley
  • Date: 2007-12-22 02:01:03 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20071222020103-ggjszok7n974e1l2
Update branches, multi-pull to new APIs, create trees

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007 Aaron Bentley <aaron@aaronbentley.com>
 
1
# Copyright (C) 2005, 2006, 2007 Aaron Bentley <aaron.bentley@utoronto.ca>
2
2
# Copyright (C) 2005, 2006 Canonical Limited.
3
3
# Copyright (C) 2006 Michael Ellerman.
4
4
#
441
441
                            help="Create a lightweight checkout."), 'revision',
442
442
                     Option('files-from', type=unicode,
443
443
                            help='Accelerate checkout using files from this'
444
 
                                 ' tree.'),
445
 
                     Option('hardlink',
446
 
                            help='Hard-link files from source/files-from tree'
447
 
                            ' where posible.')]
 
444
                                 ' tree.')]
448
445
    takes_args = ["source", "target?"]
449
446
    def run(self, source, target=None, lightweight=False, revision=None,
450
 
            files_from=None, hardlink=False):
 
447
            files_from=None):
451
448
        from cbranch import cbranch
452
449
        return cbranch(source, target, lightweight=lightweight,
453
 
                       revision=revision, files_from=files_from,
454
 
                       hardlink=hardlink)
 
450
                       revision=revision, files_from=files_from)
455
451
 
456
452
 
457
453
class cmd_branches(BzrToolsCommand):
641
637
                      working_tree=not no_tree)
642
638
 
643
639
 
644
 
class cmd_link_tree(BzrToolsCommand):
645
 
    """Hardlink matching files to another tree.
646
 
 
647
 
    Only files with identical content and execute bit will be linked.
648
 
    """
649
 
    takes_args = ['location']
650
 
 
651
 
    def run(self, location):
652
 
        from bzrlib import workingtree
653
 
        from bzrlib.plugins.bzrtools.link_tree import link_tree
654
 
        target_tree = workingtree.WorkingTree.open_containing(".")[0]
655
 
        source_tree = workingtree.WorkingTree.open(location)
656
 
        target_tree.lock_write()
657
 
        try:
658
 
            source_tree.lock_read()
659
 
            try:
660
 
                link_tree(target_tree, source_tree)
661
 
            finally:
662
 
                source_tree.unlock()
663
 
        finally:
664
 
            target_tree.unlock()
665
 
 
666
 
from heads import cmd_heads
667
640
commands = [
668
641
            cmd_baz_import,
669
642
            cmd_baz_import_branch,
670
643
            cmd_branches,
 
644
            cmd_trees,
671
645
            cmd_branch_history,
672
646
            cmd_cbranch,
673
647
            cmd_cdiff,
674
648
            cmd_clean_tree,
675
649
            cmd_fetch_ghosts,
676
650
            cmd_graph_ancestry,
677
 
            cmd_heads,
678
651
            cmd_import,
679
 
            cmd_link_tree,
680
652
            cmd_multi_pull,
681
653
            cmd_patch,
682
654
            cmd_rspush,
683
655
            cmd_shelf,
684
656
            cmd_shell,
685
657
            cmd_shelve,
686
 
            cmd_trees,
687
658
            cmd_unshelve,
688
659
            cmd_zap,
689
660
            ]
701
672
    from unittest import TestSuite
702
673
    import bzrtools
703
674
    import tests.clean_tree
704
 
    import tests.test_dotgraph
705
675
    import tests.is_clean
706
 
    import tests.test_cbranch
707
 
    import tests.test_link_tree
708
 
    import tests.test_patch
709
676
    import tests.test_rspush
710
677
    import tests.upstream_import
711
678
    import zap
724
691
    result.addTest(tests.blackbox.test_suite())
725
692
    result.addTest(tests.upstream_import.test_suite())
726
693
    result.addTest(zap.test_suite())
727
 
    result.addTest(TestLoader().loadTestsFromModule(tests.test_dotgraph))
728
694
    result.addTest(TestLoader().loadTestsFromModule(tests.is_clean))
729
 
    result.addTest(TestLoader().loadTestsFromModule(tests.test_link_tree))
730
 
    result.addTest(TestLoader().loadTestsFromModule(tests.test_patch))
731
695
    result.addTest(TestLoader().loadTestsFromModule(tests.test_rspush))
732
 
    result.addTest(TestLoader().loadTestsFromModule(tests.test_cbranch))
733
696
    return result