1
# Copyright (C) 2005, 2006, 2007 Aaron Bentley <aaron@aaronbentley.com>
2
# Copyright (C) 2005, 2006 Canonical Limited.
1
# Copyright (C) 2005, 2006, 2007, 2011 Aaron Bentley <aaron@aaronbentley.com>
2
# Copyright (C) 2005, 2006, 2011 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
23
21
from bzrlib.lazy_import import lazy_import
24
22
lazy_import(globals(), """
25
23
from bzrlib import help, urlutils
24
from bzrlib.plugins.bzrtools import shelf
27
from bzrlib.plugins import bzrtools
29
28
from command import BzrToolsCommand
30
29
from errors import CommandError
31
30
from patchsource import BzrPatchSource
35
import bzrlib.builtins
36
32
import bzrlib.commands
37
33
from bzrlib.branch import Branch
38
from bzrlib.bzrdir import BzrDir
39
34
from bzrlib.commands import get_cmd_object
40
35
from bzrlib.errors import BzrCommandError
42
from bzrlib.trace import note
43
36
from bzrlib.option import Option, RegistryOption
44
from bzrlib.workingtree import WorkingTree
46
from command import BzrToolsCommand
49
39
class cmd_graph_ancestry(BzrToolsCommand):
50
40
"""Produce ancestry graphs using dot.
52
42
Output format is detected according to file extension. Some of the more
53
43
common output formats are html, png, gif, svg, ps. An extension of '.dot'
54
44
will cause a dot graph file to be produced. HTML output has mouseovers
342
332
--all --help --revision --show-ids
343
333
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):
347
return shell.run_shell()
345
return shell.run_shell(directory)
350
348
class cmd_branch_history(BzrToolsCommand):
372
370
If --branch is specified, the branch will be deleted too, but only if the
373
371
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`
375
379
takes_options = [Option("branch", help="Remove associated branch from"
377
Option('force', help='Delete tree even if contents are'
381
RegistryOption('change_policy',
382
'How to handle changed files',
384
('bzrlib.plugins.bzrtools.zap',
385
'change_policy_registry'),
379
388
takes_args = ["checkout"]
380
def run(self, checkout, branch=False, force=False):
382
return zap(checkout, remove_branch=branch, allow_modified=force)
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)
385
405
class cmd_cbranch(BzrToolsCommand):
418
438
hardlink=hardlink)
421
class cmd_branches(BzrToolsCommand):
441
class cmd_list_branches(BzrToolsCommand):
422
442
"""Scan a location for branches"""
445
from bzrlib import commands
446
return commands.plugin_cmds.get_info('list-branches').aliases
423
448
takes_args = ["location?"]
424
449
def run(self, location=None):
425
450
from branches import branches
523
548
"""Compare a conflicted file against BASE."""
525
550
encoding_type = 'exact'
526
takes_args = ['file']
551
takes_args = ['file*']
527
552
takes_options = [
528
553
RegistryOption.from_kwargs('direction', 'Direction of comparison.',
529
554
value_switches=True, enum_switch=False,
530
555
other='Compare OTHER against common base.',
531
556
this='Compare THIS against common base.')]
533
def run(self, file, direction='other'):
558
def run(self, file_list, direction='other'):
534
559
from bzrlib.plugins.bzrtools.colordiff import DiffWriter
535
from conflict_diff import conflict_diff
560
from conflict_diff import ConflictDiffer
536
561
dw = DiffWriter(self.outf, check_style=False, color='auto')
537
conflict_diff(dw, file, direction)
562
ConflictDiffer().run(dw, file_list, direction)
540
565
class cmd_rspush(BzrToolsCommand):