~abentley/bzrtools/bzrtools.dev

672 by Aaron Bentley
Doc tweakage
1
# Copyright (C) 2008 Aaron Bentley.
670 by Aaron Bentley
Use lazy command-loading in bzrtools
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, write to the Free Software
15
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
672 by Aaron Bentley
Doc tweakage
17
"""\
675 by Aaron Bentley
More release updates
18
Various useful commands for working with bzr.
672 by Aaron Bentley
Doc tweakage
19
"""
670 by Aaron Bentley
Use lazy command-loading in bzrtools
20
682 by Aaron Bentley
Restore color shelf support
21
from bzrlib import ignores, option
670 by Aaron Bentley
Use lazy command-loading in bzrtools
22
from bzrlib.commands import plugin_cmds
675 by Aaron Bentley
More release updates
23
from version import version_info, __version__
670 by Aaron Bentley
Use lazy command-loading in bzrtools
24
25
676.1.1 by Aaron Bentley
Restore runtime ignore for .shelf
26
ignores.add_runtime_ignores(['./.shelf'])
27
28
670 by Aaron Bentley
Use lazy command-loading in bzrtools
29
commands = {
30
    'cmd_branches': [],
31
    'cmd_branch_history': [],
32
    'cmd_cbranch': [],
33
    'cmd_cdiff': [],
698 by Aaron Bentley
Implement conflict-diff
34
    'cmd_conflict_diff': [],
670 by Aaron Bentley
Use lazy command-loading in bzrtools
35
    'cmd_fetch_ghosts': ['fetch-missing'],
36
    'cmd_graph_ancestry': [],
37
    'cmd_import': [],
38
    'cmd_link_tree': [],
39
    'cmd_multi_pull': [],
40
    'cmd_patch': [],
41
    'cmd_rspush': [],
689 by Aaron Bentley
Clarify distinction between shelf1/shelf2 commands
42
    'cmd_shelf1': [],
670 by Aaron Bentley
Use lazy command-loading in bzrtools
43
    'cmd_shell': [],
44
    'cmd_shelve1': ['shelve'],
45
    'cmd_trees': [],
46
    'cmd_unshelve1': ['unshelve'],
47
    'cmd_zap': [],
48
}
49
50
51
for cmd_name, aliases in commands.items():
52
    plugin_cmds.register_lazy(cmd_name, aliases,
53
                              'bzrlib.plugins.bzrtools.command_classes')
54
682 by Aaron Bentley
Restore color shelf support
55
676.1.2 by Aaron Bentley
More cleanups
56
plugin_cmds.register_lazy('cmd_heads', [], 'bzrlib.plugins.bzrtools.heads')
670 by Aaron Bentley
Use lazy command-loading in bzrtools
57
682 by Aaron Bentley
Restore color shelf support
58
59
option.diff_writer_registry.register_lazy(
686 by Aaron Bentley
Add auto-color support to shelve
60
    'auto-color', 'bzrlib.plugins.bzrtools.colordiff', 'auto_diff_writer',
61
    'Colorized diffs, if supported',
62
)
63
option.diff_writer_registry.register_lazy(
682 by Aaron Bentley
Restore color shelf support
64
    'color', 'bzrlib.plugins.bzrtools.colordiff', 'DiffWriter',
65
    'Colorized diffs',
66
)
686 by Aaron Bentley
Add auto-color support to shelve
67
option.diff_writer_registry.default_key = 'auto-color'
682 by Aaron Bentley
Restore color shelf support
68
69
670 by Aaron Bentley
Use lazy command-loading in bzrtools
70
def test_suite():
71
    from bzrlib.tests.TestUtil import TestLoader
72
    import tests
73
    from doctest import DocTestSuite, ELLIPSIS
74
    from unittest import TestSuite
75
    import bzrtools
76
    import tests.test_dotgraph
77
    import tests.is_clean
78
    import tests.test_cbranch
702 by Aaron Bentley
Get conflict-diff under test.
79
    import tests.test_conflict_diff
707 by Aaron Bentley
Clean up fetch_ghosts.
80
    from bzrlib.plugins.bzrtools.tests import test_fetch_ghosts
670 by Aaron Bentley
Use lazy command-loading in bzrtools
81
    import tests.test_link_tree
82
    import tests.test_patch
83
    import tests.test_rspush
84
    import tests.upstream_import
85
    import zap
86
    import tests.blackbox
87
    import tests.shelf_tests
88
    result = TestSuite()
89
    result.addTest(DocTestSuite(bzrtools, optionflags=ELLIPSIS))
90
    result.addTest(tests.test_suite())
91
    result.addTest(TestLoader().loadTestsFromModule(tests.shelf_tests))
92
    result.addTest(tests.blackbox.test_suite())
93
    result.addTest(tests.upstream_import.test_suite())
94
    result.addTest(zap.test_suite())
95
    result.addTest(TestLoader().loadTestsFromModule(tests.test_dotgraph))
96
    result.addTest(TestLoader().loadTestsFromModule(tests.is_clean))
707 by Aaron Bentley
Clean up fetch_ghosts.
97
    result.addTest(TestLoader().loadTestsFromModule(test_fetch_ghosts))
670 by Aaron Bentley
Use lazy command-loading in bzrtools
98
    result.addTest(TestLoader().loadTestsFromModule(tests.test_link_tree))
99
    result.addTest(TestLoader().loadTestsFromModule(tests.test_patch))
100
    result.addTest(TestLoader().loadTestsFromModule(tests.test_rspush))
101
    result.addTest(TestLoader().loadTestsFromModule(tests.test_cbranch))
702 by Aaron Bentley
Get conflict-diff under test.
102
    result.addTest(TestLoader().loadTestsFromModule(tests.test_conflict_diff))
670 by Aaron Bentley
Use lazy command-loading in bzrtools
103
    return result