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.
552
571
branches you missed by accident. Here's an example of doing a partial
553
572
import from thelove@canonical.com:
554
573
bzr baz-import thelove thelove@canonical.com --prefixes dists:talloc-except
575
WARNING: Encoding should not be specified unless necessary, because if you
576
specify an encoding, your converted branch will not interoperate with
577
independently-converted branches, unless the other branches were converted
578
with exactly the same encoding. Any encoding recognized by Python may
579
be specified. Aliases are not detected, so 'utf_8', 'U8', 'UTF' and 'utf8'
556
582
takes_args = ['to_root_dir', 'from_archive', 'reuse_history*']
557
583
takes_options = ['verbose', Option('prefixes', type=str,
558
help="Prefixes of branches to import, colon-separated")]
584
help="Prefixes of branches to import, colon-separated"),
585
Option('encoding', type=str,
586
help='Force encoding to specified value. See WARNING.')]
560
def run(self, to_root_dir, from_archive, verbose=False,
588
def run(self, to_root_dir, from_archive, encoding=None, verbose=False,
561
589
reuse_history_list=[], prefixes=None):
562
590
from errors import NoPyBaz
564
592
import baz_import
565
baz_import.baz_import(to_root_dir, from_archive,
593
baz_import.baz_import(to_root_dir, from_archive, encoding,
566
594
verbose, reuse_history_list, prefixes)
568
596
print "This command is disabled. Please install PyBaz."
571
599
class cmd_baz_import_branch(bzrlib.commands.Command):
572
"""Import an Arch or Baz branch into a bzr branch."""
600
"""Import an Arch or Baz branch into a bzr branch.
602
WARNING: Encoding should not be specified unless necessary, because if you
603
specify an encoding, your converted branch will not interoperate with
604
independently-converted branches, unless the other branches were converted
605
with exactly the same encoding. Any encoding recognized by Python may
606
be specified. Aliases are not detected, so 'utf_8', 'U8', 'UTF' and 'utf8'
573
609
takes_args = ['to_location', 'from_branch?', 'reuse_history*']
574
takes_options = ['verbose', Option('max-count', type=int)]
610
takes_options = ['verbose', Option('max-count', type=int),
611
Option('encoding', type=str,
612
help='Force encoding to specified value. See WARNING.')]
576
614
def run(self, to_location, from_branch=None, fast=False, max_count=None,
577
verbose=False, dry_run=False, reuse_history_list=[]):
615
encoding=None, verbose=False, dry_run=False,
616
reuse_history_list=[]):
578
617
from errors import NoPyBaz
580
619
import baz_import
581
620
baz_import.baz_import_branch(to_location, from_branch, fast,
582
max_count, verbose, dry_run,
621
max_count, verbose, encoding, dry_run,
583
622
reuse_history_list)
585
624
print "This command is disabled. Please install PyBaz."
627
class cmd_rspush(bzrlib.commands.Command):
628
"""Upload this branch to another location using rsync.
630
If no location is specified, the last-used location will be used. To
631
prevent dirty trees from being uploaded, rspush will error out if there are
632
unknown files or local changes. It will also error out if the upstream
633
directory is non-empty and not an earlier version of the branch.
635
takes_args = ['location?']
636
takes_options = [Option('overwrite', help='Ignore differences between'
637
' branches and overwrite unconditionally'),
638
Option('no-tree', help='Do not push the working tree,'
641
def run(self, location=None, overwrite=False, no_tree=False):
642
from bzrlib import workingtree
644
cur_branch = workingtree.WorkingTree.open_containing(".")[0]
645
bzrtools.rspush(cur_branch, location, overwrite=overwrite,
646
working_tree=not no_tree)
649
class cmd_switch(bzrlib.commands.Command):
650
"""Set the branch of a lightweight checkout and update."""
652
takes_args = ['to_location']
654
def run(self, to_location):
655
from switch import cmd_switch
656
cmd_switch().run(to_location)
590
661
cmd_baz_import_branch,