1
# Copyright (C) 2005, 2006 Aaron Bentley <aaron.bentley@utoronto.ca>
2
# Copyright (C) 2005, 2006 Canonical Limited.
3
# Copyright (C) 2006 Michael Ellerman.
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2
20
Various useful plugins for working with bzr.
44
62
check_bzrlib_version(version_info[:2])
48
65
from errors import CommandError, NoPyBaz
49
66
from patchsource import BzrPatchSource
50
67
from shelf import Shelf
51
from switch import cmd_switch
55
71
import bzrlib.builtins
57
72
import bzrlib.commands
58
73
from bzrlib.commands import get_cmd_object
59
74
from bzrlib.errors import BzrCommandError
559
574
takes_options = ['verbose', Option('prefixes', type=str,
560
575
help="Prefixes of branches to import, colon-separated")]
562
def run(self, to_root_dir, from_archive, verbose=False,
577
def run(self, to_root_dir, from_archive, encoding=None, verbose=False,
563
578
reuse_history_list=[], prefixes=None):
564
579
from errors import NoPyBaz
566
581
import baz_import
567
baz_import.baz_import(to_root_dir, from_archive,
582
baz_import.baz_import(to_root_dir, from_archive, encoding,
568
583
verbose, reuse_history_list, prefixes)
570
585
print "This command is disabled. Please install PyBaz."
576
591
takes_options = ['verbose', Option('max-count', type=int)]
578
593
def run(self, to_location, from_branch=None, fast=False, max_count=None,
579
verbose=False, dry_run=False, reuse_history_list=[]):
594
encoding=None, verbose=False, dry_run=False,
595
reuse_history_list=[]):
580
596
from errors import NoPyBaz
582
598
import baz_import
583
599
baz_import.baz_import_branch(to_location, from_branch, fast,
584
max_count, verbose, dry_run,
600
max_count, verbose, encoding, dry_run,
585
601
reuse_history_list)
587
603
print "This command is disabled. Please install PyBaz."
606
class cmd_rspush(bzrlib.commands.Command):
607
"""Upload this branch to another location using rsync.
609
If no location is specified, the last-used location will be used. To
610
prevent dirty trees from being uploaded, rspush will error out if there are
611
unknown files or local changes. It will also error out if the upstream
612
directory is non-empty and not an earlier version of the branch.
614
takes_args = ['location?']
615
takes_options = [Option('overwrite', help='Ignore differences between'
616
' branches and overwrite unconditionally'),
617
Option('no-tree', help='Do not push the working tree,'
620
def run(self, location=None, overwrite=False, no_tree=False):
621
from bzrlib import workingtree
623
cur_branch = workingtree.WorkingTree.open_containing(".")[0]
624
bzrtools.rspush(cur_branch, location, overwrite=overwrite,
625
working_tree=not no_tree)
628
class cmd_switch(bzrlib.commands.Command):
629
"""Set the branch of a lightweight checkout and update."""
631
takes_args = ['to_location']
633
def run(self, to_location):
634
from switch import cmd_switch
635
cmd_switch().run(to_location)
592
640
cmd_baz_import_branch,