1
# Copyright (C) 2005, 2006, 2007 Aaron Bentley <aaron.bentley@utoronto.ca>
1
# Copyright (C) 2005, 2006 Aaron Bentley <aaron.bentley@utoronto.ca>
2
2
# Copyright (C) 2005, 2006 Canonical Limited.
3
3
# Copyright (C) 2006 Michael Ellerman.
47
47
# get the message out any way we can
48
48
from warnings import warn as warning
49
49
if bzrlib_version < desired:
50
warning('Installed Bazzar version %s is too old to be used with'
52
'"Bzrtools" %s.' % (bzrlib.__version__, __version__))
50
warning('Installed bzr version %s is too old to be used with bzrtools'
51
' %s.' % (bzrlib.__version__, __version__))
53
52
# Not using BzrNewError, because it may not exist.
54
53
raise Exception, ('Version mismatch', version_info)
56
warning('Plugin "Bzrtools" is not up to date with installed Bazaar'
58
' There should be a newer version of Bzrtools available, e.g.'
55
warning('Bzrtools is not up to date with installed bzr version %s.'
56
' \nThere should be a newer version available, e.g. %i.%i.'
60
57
% (bzrlib.__version__, bzrlib_version[0], bzrlib_version[1]))
61
58
if bzrlib_version != desired_plus:
62
59
raise Exception, 'Version mismatch'
157
154
help="Do not use rsvg to produce antialiased output"),
158
155
Option('merge-branch', type=str,
159
156
help="Use this branch to calcuate a merge base"),
160
Option('cluster', help="Use clustered output."),
161
Option('max-distance', help="Show no nodes farther than this",
157
Option('cluster', help="Use clustered output.")]
163
158
def run(self, branch, file, no_collapse=False, no_antialias=False,
164
merge_branch=None, cluster=False, max_distance=None):
159
merge_branch=None, cluster=False):
167
162
ranking = "cluster"
169
164
ranking = "forced"
170
165
graph.write_ancestry_file(branch, file, not no_collapse,
171
not no_antialias, merge_branch, ranking,
172
max_distance=max_distance)
166
not no_antialias, merge_branch, ranking)
175
169
class cmd_fetch_ghosts(bzrlib.commands.Command):
186
180
strip_help="""Strip the smallest prefix containing num leading slashes from \
187
181
each file name found in the patch file."""
182
Option.OPTIONS['bzrdiff'] = Option('bzrdiff',type=None,
183
help="""Handle extra bzr tags""")
190
186
class cmd_patch(bzrlib.commands.Command):
191
187
"""Apply a named patch to the current tree.
193
189
takes_args = ['filename?']
194
takes_options = [Option('strip', type=int, help=strip_help),
195
Option('silent', help='Suppress chatter')]
196
def run(self, filename=None, strip=None, silent=False):
190
takes_options = [Option('strip', type=int, help=strip_help)]
191
def run(self, filename=None, strip=-1, bzrdiff=0):
197
192
from patch import patch
198
193
from bzrlib.workingtree import WorkingTree
199
194
wt = WorkingTree.open_containing('.')[0]
202
return patch(wt, filename, strip, silent)
196
if bzrdiff: strip = 0
199
return patch(wt, filename, strip, legacy= not bzrdiff)
205
202
class cmd_shelve(bzrlib.commands.Command):
439
436
Create a new checkout, associated with a new repository branch.
441
When you cbranch, bzr looks up a target location in locations.conf, and
442
creates the branch there.
444
In your locations.conf, add the following lines:
445
[/working_directory_root]
446
cbranch_target = /branch_root
447
cbranch_target:policy = appendpath
449
This will mean that if you run "bzr cbranch foo/bar foo/baz" in the
450
working directory root, the branch will be created in
451
"/branch_root/foo/baz"
453
NOTE: cbranch also supports "cbranch_root", but that behaviour is
438
When you cbranch, bzr looks up the repository associated with your current
439
directory in locations.conf. It creates a new branch in that repository
440
with the same name and relative path as the checkout you request.
442
The locations.conf parameter is "cbranch_root". So if you want
443
cbranch operations in /home/jrandom/bigproject to produce branches in
444
/home/jrandom/bigproject/repository, you'd add this:
446
[/home/jrandom/bigproject]
447
cbranch_root = /home/jrandom/bigproject/repository
449
Note that if "/home/jrandom/bigproject/repository" isn't a repository,
450
standalone branches will be produced. Standalone branches will also
451
be produced if the source branch is in 0.7 format (or earlier).
456
453
takes_options = [Option("lightweight",
457
454
help="Create a lightweight checkout"), 'revision']
531
528
class cmd_import(bzrlib.commands.Command):
532
"""Import sources from a directory, tarball or zip file
529
"""Import sources from a tarball
534
This command will import a directory, tarball or zip file into a bzr
535
tree, replacing any versioned files already present. If a directory is
536
specified, it is used as the target. If the directory does not exist, or
537
is not versioned, it is created.
531
This command will import a tarball into a bzr tree, replacing any versioned
532
files already present. If a directory is specified, it is used as the
533
target. If the directory does not exist, or is not versioned, it is
539
536
Tarballs may be gzip or bzip2 compressed. This is autodetected.
541
If the tarball or zip has a single root directory, that directory is
542
stripped when extracting the tarball. This is not done for directories.
538
If the tarball has a single root directory, that directory is stripped
539
when extracting the tarball.
545
542
takes_args = ['source', 'tree?']
551
548
class cmd_cdiff(bzrlib.commands.Command):
552
549
"""A color version of bzr's diff"""
553
550
takes_args = property(lambda x: get_cmd_object('diff').takes_args)
555
def _takes_options(self):
556
options = list(get_cmd_object('diff').takes_options)
557
options.append(Option('check-style',
558
help='Warn if trailing whitespace or spurious changes have been'
562
takes_options = property(_takes_options)
564
def run(self, check_style=False, *args, **kwargs):
551
takes_options = property(lambda x: get_cmd_object('diff').takes_options)
552
def run(*args, **kwargs):
565
553
from colordiff import colordiff
566
colordiff(check_style, *args, **kwargs)
554
colordiff(*args, **kwargs)
569
557
class cmd_baz_import(bzrlib.commands.Command):
719
707
result.addTest(tests.test_suite())
720
708
result.addTest(TestLoader().loadTestsFromModule(tests.shelf_tests))
721
709
result.addTest(tests.blackbox.test_suite())
722
result.addTest(tests.upstream_import.test_suite())
710
result.addTest(upstream_import.test_suite())
723
711
result.addTest(zap.test_suite())