~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Michael Ellerman
  • Date: 2005-11-29 07:12:26 UTC
  • mto: (0.3.1 shelf-dev) (325.1.2 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 334.
  • Revision ID: michael@ellerman.id.au-20051129071226-a04b3f827880025d
Unshelve --pick was broken, because we deleted the whole patch, even when only
part of it was unshelved. So now if we unshelve part of a patch, the patch is
replaced with a new patch that has just the unshelved parts. That's a long way
of saying it does what you'd expect.

Implementing this required changing HunkSelector to return both the selected,
and unselected hunks (ie. patches to shelve, and patches to keep).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
 
"""\
3
 
Various useful plugins for working with bzr.
4
 
"""
5
 
import rspush
6
 
from errors import CommandError
7
 
from patchsource import BzrPatchSource
8
 
from shelf import Shelf
9
 
from switch import cmd_switch
10
 
import sys
11
 
import os.path
 
2
"""Shelf - temporarily set aside changes, then bring them back."""
12
3
 
13
 
from bzrlib import DEFAULT_IGNORE
14
 
import bzrlib.builtins
 
4
import bzrlib.commands
15
5
import bzrlib.branch
16
 
import bzrlib.commands
17
 
from bzrlib.commands import get_cmd_object
18
6
from bzrlib.errors import BzrCommandError
19
 
from bzrlib.help import command_usage
20
7
from bzrlib.option import Option
21
 
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), 
22
 
                                                 "external")))
23
 
 
24
 
 
25
 
DEFAULT_IGNORE.append('./.shelf')
26
 
DEFAULT_IGNORE.append('./.bzr-shelf*')
27
 
 
28
 
 
29
 
class cmd_clean_tree(bzrlib.commands.Command):
30
 
    """Remove unwanted files from working tree.
31
 
    Normally, ignored files are left alone.
32
 
    """
33
 
    takes_options = [Option('ignored', help='delete all ignored files.'), 
34
 
                     Option('detritus', help='delete conflict files merge'
35
 
                            ' backups, and failed selftest dirs.  (*.THIS, '
36
 
                            '*.BASE, *.OTHER, *~, *.tmp)'), 
37
 
                     Option('dry-run', help='show files to delete instead of'
38
 
                            ' deleting them.')]
39
 
    def run(self, ignored=False, detritus=False, dry_run=False):
40
 
        from clean_tree import clean_tree
41
 
        clean_tree('.', ignored=ignored, detritus=detritus, dry_run=dry_run)
42
 
 
43
 
class cmd_graph_ancestry(bzrlib.commands.Command):
44
 
    """Produce ancestry graphs using dot.
45
 
    
46
 
    Output format is detected according to file extension.  Some of the more
47
 
    common output formats are html, png, gif, svg, ps.  An extension of '.dot'
48
 
    will cause a dot graph file to be produced.  HTML output has mouseovers
49
 
    that show the commit message.
50
 
 
51
 
    Branches are labeled r?, where ? is the revno.  If they have no revno,
52
 
    with the last 5 characters of their revision identifier are used instead.
53
 
 
54
 
    The value starting with d is "(maximum) distance from the null revision".
55
 
    
56
 
    If --merge-branch is specified, the two branches are compared and a merge
57
 
    base is selected.
58
 
    
59
 
    Legend:
60
 
    white    normal revision
61
 
    yellow   THIS  history
62
 
    red      OTHER history
63
 
    orange   COMMON history
64
 
    blue     COMMON non-history ancestor
65
 
    green    Merge base (COMMON ancestor farthest from the null revision)
66
 
    dotted   Ghost revision (missing from branch storage)
67
 
 
68
 
    Ancestry is usually collapsed by skipping revisions with a single parent
69
 
    and descendant.  The number of skipped revisions is shown on the arrow.
70
 
    This feature can be disabled with --no-collapse.
71
 
 
72
 
    By default, revisions are ordered by distance from root, but they can be
73
 
    clustered instead using --cluster.
74
 
 
75
 
    If available, rsvg is used to antialias PNG and JPEG output, but this can
76
 
    be disabled with --no-antialias.
77
 
    """
78
 
    takes_args = ['branch', 'file']
79
 
    takes_options = [Option('no-collapse', help="Do not skip simple nodes"), 
80
 
                     Option('no-antialias',
81
 
                     help="Do not use rsvg to produce antialiased output"), 
82
 
                     Option('merge-branch', type=str, 
83
 
                     help="Use this branch to calcuate a merge base"), 
84
 
                     Option('cluster', help="Use clustered output.")]
85
 
    def run(self, branch, file, no_collapse=False, no_antialias=False,
86
 
        merge_branch=None, cluster=False):
87
 
        import graph
88
 
        if cluster:
89
 
            ranking = "cluster"
90
 
        else:
91
 
            ranking = "forced"
92
 
        graph.write_ancestry_file(branch, file, not no_collapse, 
93
 
                                  not no_antialias, merge_branch, ranking)
94
 
 
95
 
class cmd_fetch_ghosts(bzrlib.commands.Command):
96
 
    """Attempt to retrieve ghosts from another branch.
97
 
    If the other branch is not supplied, the last-pulled branch is used.
98
 
    """
99
 
    aliases = ['fetch-missing']
100
 
    takes_args = ['branch?']
101
 
    takes_options = [Option('no-fix')]
102
 
    def run(self, branch=None, no_fix=False):
103
 
        from fetch_ghosts import fetch_ghosts
104
 
        fetch_ghosts(branch, no_fix)
105
 
 
106
 
strip_help="""Strip the smallest prefix containing num leading slashes  from \
107
 
each file name found in the patch file."""
108
 
Option.OPTIONS['bzrdiff'] = Option('bzrdiff',type=None,
109
 
                                help="""Handle extra bzr tags""")
110
 
class cmd_patch(bzrlib.commands.Command):
111
 
    """Apply a named patch to the current tree.
112
 
    """
113
 
    takes_args = ['filename?']
114
 
    takes_options = [Option('strip', type=int, help=strip_help)]
115
 
    def run(self, filename=None, strip=-1, bzrdiff=0):
116
 
        from patch import patch
117
 
        from bzrlib.workingtree import WorkingTree
118
 
        wt = WorkingTree.open_containing('.')[0]
119
 
        if strip == -1:
120
 
            if bzrdiff: strip = 0
121
 
            else:       strip = 0
122
 
 
123
 
        return patch(wt, filename, strip, legacy= not bzrdiff)
 
8
from shelf import Shelf
124
9
 
125
10
class cmd_shelve(bzrlib.commands.Command):
126
 
    """Temporarily set aside some changes from the current tree.
 
11
    """Temporarily set aside some changes to the current working tree.
127
12
 
128
13
    Shelve allows you to temporarily put changes you've made "on the shelf",
129
14
    ie. out of the way, until a later time when you can bring them back from
130
15
    the shelf with the 'unshelve' command.
131
16
 
132
 
    Shelve is intended to help separate several sets of text changes that have
133
 
    been inappropriately mingled.  If you just want to get rid of all changes
134
 
    (text and otherwise) and you don't need to restore them later, use revert.
135
 
    If you want to shelve all text changes at once, use shelve --all.
136
 
 
137
 
    By default shelve asks you what you want to shelve, press '?' at the
138
 
    prompt to get help. To shelve everything run shelve --all.
 
17
    You can put multiple items on the shelf, each time you run unshelve the
 
18
    most recently shelved changes will be reinstated.
139
19
 
140
20
    If filenames are specified, only the changes to those files will be
141
21
    shelved, other files will be left untouched.
142
22
 
143
23
    If a revision is specified, changes since that revision will be shelved.
144
24
 
145
 
    You can put multiple items on the shelf. Normally each time you run
146
 
    unshelve the most recently shelved changes will be reinstated. However,
147
 
    you can also unshelve changes in a different order by explicitly
148
 
    specifiying which changes to unshelve. This works best when the changes
149
 
    don't depend on each other.
 
25
    If you specifiy "--pick" you'll be prompted for each hunk of the diff as
 
26
    to whether you want to shelve it or not. Press "?" at the prompt for help.
150
27
    """
151
 
 
152
28
    takes_args = ['file*']
153
 
    takes_options = ['message', 'revision',
154
 
            Option('all', help='Shelve all changes without prompting')]
 
29
    takes_options = [Option('pick'), 'message', 'revision']
 
30
    def run(self, pick=False, file_list=None, message=None, revision=None):
 
31
        if file_list is not None and len(file_list) > 0:
 
32
            branchdir = file_list[0]
 
33
        else:
 
34
            branchdir = '.'
155
35
 
156
 
    def run(self, all=False, file_list=None, message=None, revision=None):
157
36
        if revision is not None and revision:
158
37
            if len(revision) == 1:
159
38
                revision = revision[0]
160
39
            else:
161
 
                raise CommandError("shelve only accepts a single revision "
 
40
                raise BzrCommandError("shelve only accepts a single revision "
162
41
                                  "parameter.")
163
42
 
164
 
        source = BzrPatchSource(revision, file_list)
165
 
        s = Shelf(source.base)
166
 
        s.shelve(source, all, message)
167
 
        return 0
168
 
 
169
 
 
170
 
# The following classes are only used as subcommands for 'shelf', they're
171
 
# not to be registered directly with bzr.
172
 
 
173
 
class cmd_shelf_list(bzrlib.commands.Command):
174
 
    """List the patches on the current shelf."""
175
 
    aliases = ['list', 'ls']
176
 
    def run(self):
177
 
        self.shelf.list()
178
 
 
179
 
 
180
 
class cmd_shelf_delete(bzrlib.commands.Command):
181
 
    """Delete the patch from the current shelf."""
182
 
    aliases = ['delete', 'del']
183
 
    takes_args = ['patch']
184
 
    def run(self, patch):
185
 
        self.shelf.delete(patch)
186
 
 
187
 
 
188
 
class cmd_shelf_switch(bzrlib.commands.Command):
189
 
    """Switch to the other shelf, create it if necessary."""
190
 
    aliases = ['switch']
191
 
    takes_args = ['othershelf']
192
 
    def run(self, othershelf):
193
 
        s = Shelf(self.shelf.base, othershelf)
194
 
        s.make_default()
195
 
 
196
 
 
197
 
class cmd_shelf_show(bzrlib.commands.Command):
198
 
    """Show the contents of the specified or topmost patch."""
199
 
    aliases = ['show', 'cat', 'display']
200
 
    takes_args = ['patch?']
201
 
    def run(self, patch=None):
202
 
        self.shelf.display(patch)
203
 
 
204
 
 
205
 
class cmd_shelf_upgrade(bzrlib.commands.Command):
206
 
    """Upgrade old format shelves."""
207
 
    aliases = ['upgrade']
208
 
    def run(self):
209
 
        self.shelf.upgrade()
210
 
 
211
 
 
212
 
class cmd_shelf(bzrlib.commands.Command):
213
 
    """Perform various operations on your shelved patches. See also shelve."""
214
 
    takes_args = ['subcommand', 'args*']
215
 
 
216
 
    subcommands = [cmd_shelf_list, cmd_shelf_delete, cmd_shelf_switch,
217
 
        cmd_shelf_show, cmd_shelf_upgrade]
218
 
 
219
 
    def run(self, subcommand, args_list):
220
 
        import sys
221
 
 
222
 
        cmd = self._get_cmd_object(subcommand)
223
 
        source = BzrPatchSource()
224
 
        s = Shelf(source.base)
225
 
        cmd.shelf = s
226
 
        return cmd.run_argv_aliases(args_list)
227
 
 
228
 
    def _get_cmd_object(self, cmd_name):
229
 
        for cmd_class in self.subcommands:
230
 
            for alias in cmd_class.aliases:
231
 
                if alias == cmd_name:
232
 
                    return cmd_class()
233
 
        raise CommandError("Unknown shelf subcommand '%s'" % cmd_name)
234
 
 
235
 
    def help(self):
236
 
        text = ["%s\n\nSubcommands:\n" % self.__doc__]
237
 
 
238
 
        for cmd_class in self.subcommands:
239
 
            text.extend(self.sub_help(cmd_class) + ['\n'])
240
 
 
241
 
        return ''.join(text)
242
 
 
243
 
    def sub_help(self, cmd_class):
244
 
        text = []
245
 
        cmd_obj = cmd_class()
246
 
        indent = 2 * ' '
247
 
 
248
 
        usage = command_usage(cmd_obj)
249
 
        usage = usage.replace('bzr shelf-', '')
250
 
        text.append('%s%s\n' % (indent, usage))
251
 
 
252
 
        text.append('%s%s\n' % (2 * indent, cmd_class.__doc__))
253
 
 
254
 
        # Somewhat copied from bzrlib.help.help_on_command_options
255
 
        option_help = []
256
 
        for option_name, option in sorted(cmd_obj.options().items()):
257
 
            if option_name == 'help':
258
 
                continue
259
 
            option_help.append('%s--%s' % (3 * indent, option_name))
260
 
            if option.type is not None:
261
 
                option_help.append(' %s' % option.argname.upper())
262
 
            if option.short_name():
263
 
                option_help.append(', -%s' % option.short_name())
264
 
            option_help.append('%s%s\n' % (2 * indent, option.help))
265
 
 
266
 
        if len(option_help) > 0:
267
 
            text.append('%soptions:\n' % (2 * indent))
268
 
            text.extend(option_help)
269
 
 
270
 
        return text
271
 
 
272
 
 
 
43
        s = Shelf(branchdir)
 
44
        return s.shelve(pick, message, revision, file_list)
273
45
 
274
46
class cmd_unshelve(bzrlib.commands.Command):
275
 
    """Restore shelved changes.
276
 
 
277
 
    By default the most recently shelved changes are restored. However if you
278
 
    specify a patch by name those changes will be restored instead.
279
 
 
 
47
    """Reinstate the most recently shelved changes.
280
48
    See 'shelve' for more information.
281
49
    """
282
 
    takes_options = [
283
 
            Option('all', help='Unshelve all changes without prompting'),
284
 
            Option('force', help='Force unshelving even if errors occur'),
285
 
    ]
286
 
    takes_args = ['patch?']
287
 
    def run(self, patch=None, all=False, force=False):
288
 
        source = BzrPatchSource()
289
 
        s = Shelf(source.base)
290
 
        s.unshelve(source, patch, all, force)
291
 
        return 0
292
 
 
293
 
 
294
 
class cmd_shell(bzrlib.commands.Command):
295
 
    """Begin an interactive shell tailored for bzr.
296
 
    Bzr commands can be used without typing bzr first, and will be run natively
297
 
    when possible.  Tab completion is tailored for bzr.  The shell prompt shows
298
 
    the branch nick, revno, and path.
299
 
 
300
 
    If it encounters any moderately complicated shell command, it will punt to
301
 
    the system shell.
302
 
 
303
 
    Example:
304
 
    $ bzr shell
305
 
    bzr bzrtools:287/> status
306
 
    modified:
307
 
      __init__.py
308
 
    bzr bzrtools:287/> status --[TAB][TAB]
309
 
    --all        --help       --revision   --show-ids
310
 
    bzr bzrtools:287/> status --
311
 
    """
312
 
    def run(self):
313
 
        import shell
314
 
        return shell.run_shell()
315
 
 
316
 
class cmd_branch_history(bzrlib.commands.Command):
317
 
    """\
318
 
    Display the development history of a branch.
319
 
 
320
 
    Each different committer or branch nick is considered a different line of
321
 
    development.  Committers are treated as the same if they have the same
322
 
    name, or if they have the same email address.
323
 
    """
324
 
    takes_args = ["branch?"]
325
 
    def run(self, branch=None):
326
 
        from branchhistory import branch_history 
327
 
        return branch_history(branch)
328
 
 
329
 
 
330
 
class cmd_zap(bzrlib.commands.Command):
331
 
    """\
332
 
    Remove a lightweight checkout, if it can be done safely.
333
 
 
334
 
    This command will remove a lightweight checkout without losing data.  That
335
 
    means it only removes lightweight checkouts, and only if they have no
336
 
    uncommitted changes.
337
 
 
338
 
    If --branch is specified, the branch will be deleted too, but only if the
339
 
    the branch has no new commits (relative to its parent).
340
 
    """
341
 
    takes_options = [Option("branch", help="Remove associtated branch from"
342
 
                                           " repository")]
343
 
    takes_args = ["checkout"]
344
 
    def run(self, checkout, branch=False):
345
 
        from zap import zap
346
 
        return zap(checkout, remove_branch=branch)
347
 
 
348
 
 
349
 
class cmd_cbranch(bzrlib.commands.Command):
350
 
    """
351
 
    Create a new checkout, associated with a new repository branch.
352
 
    
353
 
    When you cbranch, bzr looks up the repository associated with your current
354
 
    directory in branches.conf.  It creates a new branch in that repository
355
 
    with the same name and relative path as the checkout you request.
356
 
 
357
 
    The branches.conf parameter is "cbranch_root".  So if you want 
358
 
    cbranch operations in /home/jrandom/bigproject to produce branches in 
359
 
    /home/jrandom/bigproject/repository, you'd add this:
360
 
 
361
 
    [/home/jrandom/bigproject]
362
 
    cbranch_root = /home/jrandom/bigproject/repository
363
 
 
364
 
    Note that if "/home/jrandom/bigproject/repository" isn't a repository,
365
 
    standalone branches will be produced.  Standalone branches will also
366
 
    be produced if the source branch is in 0.7 format (or earlier).
367
 
    """
368
 
    takes_options = [Option("lightweight", 
369
 
                            help="Create a lightweight checkout")]
370
 
    takes_args = ["source", "target?"]
371
 
    def run(self, source, target=None, lightweight=False):
372
 
        from cbranch import cbranch
373
 
        return cbranch(source, target, lightweight=lightweight)
374
 
 
375
 
 
376
 
class cmd_branches(bzrlib.commands.Command):
377
 
    """Scan a location for branches"""
378
 
    takes_args = ["location?"]
379
 
    def run(self, location=None):
380
 
        from branches import branches
381
 
        return branches(location)
382
 
 
383
 
 
384
 
class cmd_multi_pull(bzrlib.commands.Command):
385
 
    """Pull all the branches under a location, e.g. a repository.
386
 
    
387
 
    Both branches present in the directory and the branches of checkouts are
388
 
    pulled.
389
 
    """
390
 
    takes_args = ["location?"]
391
 
    def run(self, location=None):
392
 
        from bzrlib.branch import Branch
393
 
        from bzrlib.transport import get_transport
394
 
        from bzrtools import iter_branch_tree
395
 
        if location is None:
396
 
            location = '.'
397
 
        t = get_transport(location)
398
 
        if not t.listable():
399
 
            print "Can't list this type of location."
400
 
            return 3
401
 
        for branch, wt in iter_branch_tree(t):
402
 
            if wt is None:
403
 
                pullable = branch
404
 
            else:
405
 
                pullable = wt
406
 
            parent = branch.get_parent()
407
 
            if parent is None:
408
 
                continue
409
 
            if wt is not None:
410
 
                base = wt.basedir
411
 
            else:
412
 
                base = branch.base
413
 
            if base.startswith(t.base):
414
 
                relpath = base[len(t.base):].rstrip('/')
415
 
            else:
416
 
                relpath = base
417
 
            print "Pulling %s from %s" % (relpath, parent)
418
 
            try:
419
 
                pullable.pull(Branch.open(parent))
420
 
            except Exception, e:
421
 
                print e
422
 
 
423
 
 
424
 
class cmd_branch_mark(bzrlib.commands.Command):
425
 
    """
426
 
    Add, view or list branch markers <EXPERIMENTAL>
427
 
 
428
 
    To add a mark, do 'bzr branch-mark MARK'.
429
 
    To list marks, do 'bzr branch-mark' (this lists all marks for the branch's
430
 
    repository).
431
 
    To delete a mark, do 'bzr branch-mark --delete MARK'
432
 
 
433
 
    These marks can be used to track a branch's status.
434
 
    """
435
 
    takes_args = ['mark?', 'branch?']
436
 
    takes_options = [Option('delete', help='Delete this mark')]
437
 
    def run(self, mark=None, branch=None, delete=False):
438
 
        from branch_mark import branch_mark
439
 
        branch_mark(mark, branch, delete)
440
 
 
441
 
class cmd_import(bzrlib.commands.Command):
442
 
    """Import sources from a tarball
443
 
    
444
 
    This command will import a tarball into a bzr tree, replacing any versioned
445
 
    files already present.  If a directory is specified, it is used as the
446
 
    target.  If the directory does not exist, or is not versioned, it is
447
 
    created.
448
 
 
449
 
    Tarballs may be gzip or bzip2 compressed.  This is autodetected.
450
 
 
451
 
    If the tarball has a single root directory, that directory is stripped
452
 
    when extracting the tarball.
453
 
    """
454
 
    
455
 
    takes_args = ['source', 'tree?']
456
 
    def run(self, source, tree=None):
457
 
        from upstream_import import do_import
458
 
        do_import(source, tree)
459
 
 
460
 
class cmd_shove(bzrlib.commands.Command):
461
 
    """Apply uncommitted changes to another tree
462
 
    
463
 
    This is useful when you start to make changes in one tree, then realize
464
 
    they should really be done in a different tree.
465
 
 
466
 
    Shove is implemented using merge, so:
467
 
     - All changes, including renames and adds, will be applied.
468
 
     - No changes that have already been applied will be applied.
469
 
     - If the target is significantly different from the source, conflicts may
470
 
       be produced.
471
 
    """
472
 
 
473
 
    takes_args = ['target', 'source?']
474
 
    def run(self, target, source='.'):
475
 
        from shove import do_shove
476
 
        do_shove(source, target)
477
 
 
478
 
class cmd_cdiff(bzrlib.commands.Command):
479
 
    """A color version of bzr's diff"""
480
 
    takes_args = property(lambda x: get_cmd_object('diff').takes_args)
481
 
    takes_options = property(lambda x: get_cmd_object('diff').takes_options)
482
 
    def run(*args, **kwargs):
483
 
        from colordiff import colordiff
484
 
        colordiff(*args, **kwargs)
485
 
 
486
 
commands = [cmd_shelve, cmd_unshelve, cmd_shelf, cmd_clean_tree,
487
 
            cmd_graph_ancestry, cmd_fetch_ghosts, cmd_patch, cmd_shell,
488
 
            cmd_branch_history, cmd_zap, cmd_cbranch, cmd_branches, 
489
 
            cmd_multi_pull, cmd_switch, cmd_branch_mark, cmd_import, cmd_shove,
490
 
            cmd_cdiff]
491
 
 
492
 
 
493
 
commands.append(rspush.cmd_rspush)
494
 
 
495
 
from errors import NoPyBaz
496
 
try:
497
 
    import baz_import
498
 
    commands.append(baz_import.cmd_baz_import_branch)
499
 
    commands.append(baz_import.cmd_baz_import)
500
 
 
501
 
except NoPyBaz:
502
 
    class cmd_baz_import_branch(bzrlib.commands.Command):
503
 
        """Disabled. (Requires PyBaz)"""
504
 
        takes_args = ['to_location?', 'from_branch?', 'reuse_history*']
505
 
        takes_options = ['verbose', Option('max-count', type=int)]
506
 
        def run(self, to_location=None, from_branch=None, fast=False, 
507
 
                max_count=None, verbose=False, dry_run=False,
508
 
                reuse_history_list=[]):
509
 
            print "This command is disabled.  Please install PyBaz."
510
 
 
511
 
 
512
 
    class cmd_baz_import(bzrlib.commands.Command):
513
 
        """Disabled. (Requires PyBaz)"""
514
 
        takes_args = ['to_root_dir?', 'from_archive?', 'reuse_history*']
515
 
        takes_options = ['verbose', Option('prefixes', type=str,
516
 
                         help="Prefixes of branches to import")]
517
 
        def run(self, to_root_dir=None, from_archive=None, verbose=False,
518
 
                reuse_history_list=[], prefixes=None):
519
 
                print "This command is disabled.  Please install PyBaz."
520
 
    commands.extend((cmd_baz_import_branch, cmd_baz_import))
521
 
 
522
 
 
523
 
if hasattr(bzrlib.commands, 'register_command'):
524
 
    for command in commands:
525
 
        bzrlib.commands.register_command(command)
526
 
 
 
50
    takes_options = [Option('pick')]
 
51
    def run(self, pick=False):
 
52
        s = Shelf('.')
 
53
        return s.unshelve(pick)
 
54
 
 
55
bzrlib.commands.register_command(cmd_shelve)
 
56
bzrlib.commands.register_command(cmd_unshelve)
527
57
 
528
58
def test_suite():
529
59
    from bzrlib.tests.TestUtil import TestLoader
530
60
    import tests
531
 
    from doctest import DocTestSuite, ELLIPSIS
532
 
    from unittest import TestSuite
533
 
    import tests.clean_tree
534
 
    import upstream_import
535
 
    import zap
536
 
    import tests.blackbox
537
 
    import tests.shelf_tests
538
 
    result = TestSuite()
539
 
    result.addTest(DocTestSuite(bzrtools, optionflags=ELLIPSIS))
540
 
    result.addTest(tests.clean_tree.test_suite())
541
 
    try:
542
 
        import baz_import
543
 
        result.addTest(DocTestSuite(baz_import))
544
 
    except NoPyBaz:
545
 
        pass
546
 
    result.addTest(tests.test_suite())
547
 
    result.addTest(TestLoader().loadTestsFromModule(tests.shelf_tests))
548
 
    result.addTest(tests.blackbox.test_suite())
549
 
    result.addTest(upstream_import.test_suite())
550
 
    result.addTest(zap.test_suite())
551
 
    return result
 
61
    return TestLoader().loadTestsFromModule(tests)