3
3
Various useful plugins for working with bzr.
5
5
import bzrlib.commands
7
7
from errors import CommandError
8
8
from patchsource import BzrPatchSource
9
9
from shelf import Shelf
10
from switch import cmd_switch
12
13
from bzrlib.option import Option
13
14
import bzrlib.branch
14
15
from bzrlib.errors import BzrCommandError
15
16
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__),
17
18
from bzrlib import DEFAULT_IGNORE
269
270
This command will remove a checkout without losing data. That means
270
271
it only removes checkouts, and only if they have no uncommitted changes.
273
takes_options = [Option("branch", help="Remove associtated branch from"
272
275
takes_args = ["checkout"]
273
def run(self, checkout):
276
def run(self, checkout, branch=False):
274
277
from zap import zap
278
return zap(checkout, remove_branch=branch)
278
281
class cmd_cbranch(bzrlib.commands.Command):
294
297
standalone branches will be produced. Standalone branches will also
295
298
be produced if the source branch is in 0.7 format (or earlier).
297
takes_args = ["source", "target"]
298
def run(self, source, target):
300
takes_options = [Option("lightweight",
301
help="Create a lightweight checkout")]
302
takes_args = ["source", "target?"]
303
def run(self, source, target=None, lightweight=False):
299
304
from cbranch import cbranch
300
return cbranch(source, target)
305
return cbranch(source, target, lightweight=lightweight)
302
308
class cmd_branches(bzrlib.commands.Command):
303
309
"""Scan a location for branches <BZRTOOLS>"""
356
class cmd_branch_mark(bzrlib.commands.Command):
358
Add, view or list branch markers <EXPERIMENTAL>
360
To add a mark, do 'bzr branch-mark MARK'.
361
To list marks, do 'bzr branch-mark' (this lists all marks for the branch's
363
To delete a mark, do 'bzr branch-mark --delete MARK'
365
These marks can be used to track a branch's status.
367
takes_args = ['mark?', 'branch?']
368
takes_options = [Option('delete', help='Delete this mark')]
369
def run(self, mark=None, branch=None, delete=False):
370
from branch_mark import branch_mark
371
branch_mark(mark, branch, delete)
350
374
commands = [cmd_shelve, cmd_unshelve, cmd_shelf, cmd_clean_tree,
351
375
cmd_graph_ancestry, cmd_fetch_ghosts, cmd_patch, cmd_shell,
352
376
cmd_branch_history, cmd_zap, cmd_cbranch, cmd_branches,
356
command_decorators = []
377
cmd_multi_pull, cmd_switch, cmd_branch_mark]
359
382
import bzrlib.builtins
360
if not hasattr(bzrlib.builtins, "cmd_push"):
361
commands.append(push.cmd_push)
363
command_decorators.append(push.cmd_push)
383
commands.append(rspush.cmd_rspush)
365
385
from errors import NoPyBaz
393
413
if hasattr(bzrlib.commands, 'register_command'):
394
414
for command in commands:
395
415
bzrlib.commands.register_command(command)
396
for command in command_decorators:
397
command._original_command = bzrlib.commands.register_command(
401
418
def test_suite():