1
# Copyright (C) 2005, 2006, 2007, 2011 Aaron Bentley <aaron@aaronbentley.com>
2
# Copyright (C) 2005, 2006, 2011 Canonical Limited.
1
# Copyright (C) 2005, 2006, 2007 Aaron Bentley <aaron@aaronbentley.com>
2
# Copyright (C) 2005, 2006 Canonical Limited.
3
3
# Copyright (C) 2006 Michael Ellerman.
5
5
# This program is free software; you can redistribute it and/or modify
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
23
from bzrlib.lazy_import import lazy_import
22
24
lazy_import(globals(), """
23
25
from bzrlib import help, urlutils
24
from bzrlib.plugins.bzrtools import shelf
27
from bzrlib.plugins import bzrtools
28
29
from command import BzrToolsCommand
29
30
from errors import CommandError
30
31
from patchsource import BzrPatchSource
35
import bzrlib.builtins
32
36
import bzrlib.commands
33
37
from bzrlib.branch import Branch
38
from bzrlib.bzrdir import BzrDir
34
39
from bzrlib.commands import get_cmd_object
35
40
from bzrlib.errors import BzrCommandError
42
from bzrlib.trace import note
36
43
from bzrlib.option import Option, RegistryOption
44
from bzrlib.workingtree import WorkingTree
46
from command import BzrToolsCommand
39
49
class cmd_graph_ancestry(BzrToolsCommand):
40
50
"""Produce ancestry graphs using dot.
42
52
Output format is detected according to file extension. Some of the more
43
53
common output formats are html, png, gif, svg, ps. An extension of '.dot'
44
54
will cause a dot graph file to be produced. HTML output has mouseovers
332
342
--all --help --revision --show-ids
333
343
bzr bzrtools:287/> status --
337
help='Branch in which to start the shell, '
338
'rather than the one containing the working directory.',
343
def run(self, directory=None):
345
return shell.run_shell(directory)
347
return shell.run_shell()
348
350
class cmd_branch_history(BzrToolsCommand):
370
372
If --branch is specified, the branch will be deleted too, but only if the
371
373
the branch has no new commits (relative to its parent).
373
If bzr-pipeline is also installed, the --store option will store changes
374
in the branch before deleting the tree. To restore the changes, do::
376
bzr checkout --lightweight $BRANCH $CHECKOUT
377
bzr switch-pipe -d $CHECKOUT `bzr nick -d $CHECKOUT`
379
375
takes_options = [Option("branch", help="Remove associated branch from"
381
RegistryOption('change_policy',
382
'How to handle changed files',
384
('bzrlib.plugins.bzrtools.zap',
385
'change_policy_registry'),
377
Option('force', help='Delete tree even if contents are'
388
379
takes_args = ["checkout"]
389
def run(self, checkout, branch=False, change_policy=None):
391
change_policy_registry,
395
if change_policy is None:
396
change_policy = change_policy_registry.get()
397
if change_policy is StoreChanges:
399
import bzrlib.plugins.pipeline
401
raise BzrCommandError('--store requires bzr-pipeline.')
402
return zap(checkout, remove_branch=branch, policy=change_policy)
380
def run(self, checkout, branch=False, force=False):
382
return zap(checkout, remove_branch=branch, allow_modified=force)
405
385
class cmd_cbranch(BzrToolsCommand):
438
418
hardlink=hardlink)
441
class cmd_list_branches(BzrToolsCommand):
421
class cmd_branches(BzrToolsCommand):
442
422
"""Scan a location for branches"""
445
from bzrlib import commands
446
return commands.plugin_cmds.get_info('list-branches').aliases
448
423
takes_args = ["location?"]
449
424
def run(self, location=None):
450
425
from branches import branches
548
523
"""Compare a conflicted file against BASE."""
550
525
encoding_type = 'exact'
551
takes_args = ['file*']
526
takes_args = ['file']
552
527
takes_options = [
553
528
RegistryOption.from_kwargs('direction', 'Direction of comparison.',
554
529
value_switches=True, enum_switch=False,
555
530
other='Compare OTHER against common base.',
556
531
this='Compare THIS against common base.')]
558
def run(self, file_list, direction='other'):
533
def run(self, file, direction='other'):
559
534
from bzrlib.plugins.bzrtools.colordiff import DiffWriter
560
from conflict_diff import ConflictDiffer
535
from conflict_diff import conflict_diff
561
536
dw = DiffWriter(self.outf, check_style=False, color='auto')
562
ConflictDiffer().run(dw, file_list, direction)
537
conflict_diff(dw, file, direction)
565
540
class cmd_rspush(BzrToolsCommand):