26
__version__ = '0.90.0'
29
version_info = tuple(int(n) for n in __version__.split('.'))
32
def check_bzrlib_version(desired):
33
"""Check that bzrlib is compatible.
35
If version is < bzrtools version, assume incompatible.
36
If version == bzrtools version, assume completely compatible
37
If version == bzrtools version + 1, assume compatible, with deprecations
38
Otherwise, assume incompatible.
40
desired_plus = (desired[0], desired[1]+1)
41
bzrlib_version = bzrlib.version_info[:2]
42
if bzrlib_version == desired or (bzrlib_version == desired_plus and
43
bzrlib.version_info[3] == 'dev'):
46
from bzrlib.trace import warning
48
# get the message out any way we can
49
from warnings import warn as warning
50
if bzrlib_version < desired:
51
warning('Installed Bazaar version %s is too old to be used with'
53
'"Bzrtools" %s.' % (bzrlib.__version__, __version__))
54
# Not using BzrNewError, because it may not exist.
55
raise Exception, ('Version mismatch', version_info)
57
warning('Plugin "Bzrtools" is not up to date with installed Bazaar'
59
' There should be a newer version of Bzrtools available, e.g.'
61
% (bzrlib.__version__, bzrlib_version[0], bzrlib_version[1]))
62
if bzrlib_version != desired_plus:
63
raise Exception, 'Version mismatch'
66
check_bzrlib_version(version_info[:2])
68
25
from bzrlib.lazy_import import lazy_import
69
26
lazy_import(globals(), """
70
27
from bzrlib import help
31
from version import version_info, __version__
32
from command import BzrToolsCommand
74
33
from errors import CommandError, NoPyBaz
75
34
from patchsource import BzrPatchSource
48
from command import BzrToolsCommand
90
50
bzrlib.ignores.add_runtime_ignores(['./.shelf'])
93
class cmd_clean_tree(bzrlib.commands.Command):
53
class cmd_clean_tree(BzrToolsCommand):
94
54
"""Remove unwanted files from working tree.
96
56
By default, only unknown files, not ignored files, are deleted. Versioned
185
145
max_distance=max_distance)
188
class cmd_fetch_ghosts(bzrlib.commands.Command):
148
class cmd_fetch_ghosts(BzrToolsCommand):
189
149
"""Attempt to retrieve ghosts from another branch.
190
150
If the other branch is not supplied, the last-pulled branch is used.
200
160
each file name found in the patch file."""
203
class cmd_patch(bzrlib.commands.Command):
163
class cmd_patch(BzrToolsCommand):
204
164
"""Apply a named patch to the current tree.
206
166
takes_args = ['filename?']
215
175
return patch(wt, filename, strip, silent)
218
class cmd_shelve(bzrlib.commands.Command):
178
class cmd_shelve(BzrToolsCommand):
219
179
"""Temporarily set aside some changes from the current tree.
221
181
Shelve allows you to temporarily put changes you've made "on the shelf",
310
270
self.shelf.upgrade()
313
class cmd_shelf(bzrlib.commands.Command):
273
class cmd_shelf(BzrToolsCommand):
314
274
"""Perform various operations on your shelved patches. See also shelve."""
315
275
takes_args = ['subcommand', 'args*']
400
class cmd_shell(bzrlib.commands.Command):
360
class cmd_shell(BzrToolsCommand):
401
361
"""Begin an interactive shell tailored for bzr.
402
362
Bzr commands can be used without typing bzr first, and will be run natively
403
363
when possible. Tab completion is tailored for bzr. The shell prompt shows
453
413
return zap(checkout, remove_branch=branch)
456
class cmd_cbranch(bzrlib.commands.Command):
416
class cmd_cbranch(BzrToolsCommand):
458
418
Create a new checkout, associated with a new repository branch.
481
441
revision=revision)
484
class cmd_branches(bzrlib.commands.Command):
444
class cmd_branches(BzrToolsCommand):
485
445
"""Scan a location for branches"""
486
446
takes_args = ["location?"]
487
447
def run(self, location=None):
489
449
return branches(location)
492
class cmd_multi_pull(bzrlib.commands.Command):
452
class cmd_multi_pull(BzrToolsCommand):
493
453
"""Pull all the branches under a location, e.g. a repository.
495
455
Both branches present in the directory and the branches of checkouts are
547
507
branch_mark(mark, branch, delete)
550
class cmd_import(bzrlib.commands.Command):
510
class cmd_import(BzrToolsCommand):
551
511
"""Import sources from a directory, tarball or zip file
553
513
This command will import a directory, tarball or zip file into a bzr
567
527
do_import(source, tree)
570
class cmd_cdiff(bzrlib.commands.Command):
530
class cmd_cdiff(BzrToolsCommand):
571
531
"""A color version of bzr's diff"""
572
532
takes_args = property(lambda x: get_cmd_object('diff').takes_args)
573
533
takes_options = list(get_cmd_object('diff').takes_options) + [
580
540
colordiff(check_style, *args, **kwargs)
583
class cmd_baz_import(bzrlib.commands.Command):
543
class cmd_baz_import(BzrToolsCommand):
584
544
"""Import an Arch or Baz archive into a bzr repository.
586
546
This command should be used on local archives (or mirrors) only. It is
622
582
print "This command is disabled. Please install PyBaz."
625
class cmd_baz_import_branch(bzrlib.commands.Command):
585
class cmd_baz_import_branch(BzrToolsCommand):
626
586
"""Import an Arch or Baz branch into a bzr branch.
628
588
WARNING: Encoding should not be specified unless necessary, because if you
652
612
print "This command is disabled. Please install PyBaz."
655
class cmd_rspush(bzrlib.commands.Command):
615
class cmd_rspush(BzrToolsCommand):
656
616
"""Upload this branch to another location using rsync.
658
618
If no location is specified, the last-used location will be used. To
674
634
working_tree=not no_tree)
677
class cmd_switch(bzrlib.commands.Command):
637
class cmd_switch(BzrToolsCommand):
678
638
"""Set the branch of a lightweight checkout and update."""
680
640
takes_args = ['to_location']