~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Aaron Bentley
  • Date: 2006-05-03 20:05:46 UTC
  • mto: This revision was merged to the branch mainline in revision 366.
  • Revision ID: abentley@panoramicfeedback.com-20060503200546-83ae584b88d70a6b
Changed rpush to rspush

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
Various useful plugins for working with bzr.
4
4
"""
5
5
import bzrlib.commands
6
 
import push
 
6
import rspush
7
7
from errors import CommandError
8
8
from patchsource import BzrPatchSource
9
9
from shelf import Shelf
 
10
from switch import cmd_switch
10
11
import sys
11
12
import os.path
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__), 
16
 
                                                 "external")))
 
17
                                                 "external")))
17
18
from bzrlib import DEFAULT_IGNORE
18
19
 
19
20
 
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.
271
272
    """
 
273
    takes_options = [Option("branch", help="Remove associtated branch from"
 
274
                                           " repository")]
272
275
    takes_args = ["checkout"]
273
 
    def run(self, checkout):
 
276
    def run(self, checkout, branch=False):
274
277
        from zap import zap
275
 
        return zap(checkout)
 
278
        return zap(checkout, remove_branch=branch)
276
279
 
277
280
 
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).
296
299
    """
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)
 
306
 
301
307
 
302
308
class cmd_branches(bzrlib.commands.Command):
303
309
    """Scan a location for branches <BZRTOOLS>"""
347
353
                print e
348
354
 
349
355
 
 
356
class cmd_branch_mark(bzrlib.commands.Command):
 
357
    """
 
358
    Add, view or list branch markers <EXPERIMENTAL>
 
359
 
 
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
 
362
    repository).
 
363
    To delete a mark, do 'bzr branch-mark --delete MARK'
 
364
 
 
365
    These marks can be used to track a branch's status.
 
366
    """
 
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)
 
372
 
 
373
 
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, 
353
 
            cmd_multi_pull]
354
 
 
355
 
 
356
 
command_decorators = []
 
377
            cmd_multi_pull, cmd_switch, cmd_branch_mark]
 
378
 
 
379
 
357
380
 
358
381
 
359
382
import bzrlib.builtins
360
 
if not hasattr(bzrlib.builtins, "cmd_push"):
361
 
    commands.append(push.cmd_push)
362
 
else:
363
 
    command_decorators.append(push.cmd_push)
 
383
commands.append(rspush.cmd_rspush)
364
384
 
365
385
from errors import NoPyBaz
366
386
try:
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(
398
 
            command, True)
399
416
 
400
417
 
401
418
def test_suite():