~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Aaron Bentley
  • Date: 2005-12-14 14:33:05 UTC
  • Revision ID: abentley@panoramicfeedback.com-20051214143305-42718d97f27c03bd
Avoided leaving junk all over the place when running standalone tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
from bzrlib.option import Option
12
12
import bzrlib.branch
13
13
from bzrlib.errors import BzrCommandError
 
14
sys.path.append(os.path.dirname(__file__))
14
15
from reweave_inventory import cmd_fix
15
 
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), 
16
 
                                                 "external")))
17
16
 
18
17
Option.OPTIONS['ignored'] = Option('ignored',
19
18
        help='delete all ignored files.')
32
31
        from clean_tree import clean_tree
33
32
        clean_tree('.', ignored=ignored, detritus=detritus, dry_run=dry_run)
34
33
 
35
 
Option.OPTIONS['no-collapse'] = Option('no-collapse')
36
 
Option.OPTIONS['no-antialias'] = Option('no-antialias')
37
 
Option.OPTIONS['cluster'] = Option('cluster')
38
34
Option.OPTIONS['merge-branch'] = Option('merge-branch',type=str)
39
35
 
40
36
class cmd_graph_ancestry(bzrlib.commands.Command):
41
37
    """Produce ancestry graphs using dot.
42
38
    
43
39
    Output format is detected according to file extension.  Some of the more
44
 
    common output formats are png, gif, svg, ps.  An extension of '.dot' will
45
 
    cause a dot graph file to be produced.
 
40
    common output formats are html, png, gif, svg, ps.  An extension of '.dot'
 
41
    will cause a dot graph file to be produced.  HTML output has mouseovers
 
42
    that show the commit message.
46
43
 
47
44
    Branches are labeled r?, where ? is the revno.  If they have no revno,
48
45
    with the last 5 characters of their revision identifier are used instead.
 
46
 
 
47
    The value starting with d is "(maximum) distance from the null revision".
49
48
    
50
49
    If --merge-branch is specified, the two branches are compared and a merge
51
50
    base is selected.
56
55
    red      OTHER history
57
56
    orange   COMMON history
58
57
    blue     COMMON non-history ancestor
59
 
    dotted   Missing from branch storage
 
58
    green    Merge base (COMMON ancestor farthest from the null revision)
 
59
    dotted   Ghost revision (missing from branch storage)
60
60
 
61
 
    Ancestry is usually collapsed by removing revisions with a single parent
 
61
    Ancestry is usually collapsed by skipping revisions with a single parent
62
62
    and descendant.  The number of skipped revisions is shown on the arrow.
63
63
    This feature can be disabled with --no-collapse.
64
64
 
69
69
    be disabled with --no-antialias.
70
70
    """
71
71
    takes_args = ['branch', 'file']
72
 
    takes_options = ['no-collapse', 'no-antialias', 'merge-branch', 'cluster']
 
72
    takes_options = [Option('no-collapse', help="Do not skip simple nodes"), 
 
73
                     Option('no-antialias',
 
74
                     help="Do not use rsvg to produce antialiased output"), 
 
75
                     Option('merge-branch', type=str, 
 
76
                     help="Use this branch to calcuate a merge base"), 
 
77
                     Option('cluster', help="Use clustered output.")]
73
78
    def run(self, branch, file, no_collapse=False, no_antialias=False,
74
79
        merge_branch=None, cluster=False):
75
80
        import graph
107
112
 
108
113
 
109
114
class cmd_shelve(bzrlib.commands.Command):
110
 
    """Temporarily remove some changes from the current tree.
 
115
    """Temporarily remove some text changes from the current tree.
111
116
    Use 'unshelve' to restore these changes.
112
117
 
113
 
    If filenames are specified, only changes to those files will be unshelved.
 
118
    Shelve is intended to help separate several sets of text changes that have
 
119
    been inappropriately mingled.  If you just want to get rid of all changes
 
120
    (text and otherwise) and you don't need to restore them later, use revert.
 
121
    If you want to shelve all text changes at once, use shelve --all.
 
122
 
 
123
    If filenames are specified, only changes to those files will be shelved.
114
124
    If a revision is specified, all changes since that revision will may be
115
 
    unshelved.
 
125
    shelved.
116
126
    """
117
127
    takes_args = ['file*']
118
 
    takes_options = ['all', 'message', 'revision']
 
128
    takes_options = [Option('all', 
 
129
                            help='Shelve all changes without prompting'), 
 
130
                     'message', 'revision']
119
131
    def run(self, all=False, file_list=None, message=None, revision=None):
120
132
        if file_list is not None and len(file_list) > 0:
121
133
            branchdir = file_list[0]
163
175
        import shell
164
176
        return shell.run_shell()
165
177
 
 
178
class cmd_branch_history(bzrlib.commands.Command):
 
179
    """\
 
180
    Display the revision history with reference to lines of development.
 
181
 
 
182
    Each different committer or branch nick is considered a different line of
 
183
    development.  Committers are treated as the same if they have the same
 
184
    name, or if they have the same email address.
 
185
    """
 
186
    takes_args = ["branch?"]
 
187
    def run(self, branch=None):
 
188
        from branchhistory import branch_history 
 
189
        return branch_history(branch)
 
190
 
166
191
commands = [cmd_shelve, cmd_unshelve, cmd_clean_tree, cmd_graph_ancestry,
167
 
            cmd_fetch_ghosts, cmd_patch, cmd_shell, cmd_fix]
168
 
 
169
 
command_decorators = []
 
192
            cmd_fetch_ghosts, cmd_patch, cmd_shell, cmd_fix, cmd_branch_history]
170
193
 
171
194
command_decorators = []
172
195
 
181
204
from errors import NoPyBaz
182
205
try:
183
206
    import baz_import
184
 
    commands.append(baz_import.cmd_baz_import_branch)
185
207
    commands.append(baz_import.cmd_baz_import)
186
208
 
187
209
except NoPyBaz:
203
225
 
204
226
 
205
227
def test_suite():
206
 
    import baz_import
207
 
    import tests
208
228
    from doctest import DocTestSuite
209
229
    from unittest import TestSuite, TestLoader
210
230
    import clean_tree
213
233
    result = TestSuite()
214
234
    result.addTest(DocTestSuite(bzrtools))
215
235
    result.addTest(clean_tree.test_suite())
216
 
    result.addTest(DocTestSuite(baz_import))
217
 
    result.addTest(tests.test_suite())
218
236
    result.addTest(TestLoader().loadTestsFromModule(shelf_tests))
219
237
    result.addTest(blackbox.test_suite())
220
238
    return result