186
170
takes_args = ['file*']
187
171
takes_options = ['show-ids', 'revision',
188
Option('short', help='Give short SVN-style status lines'),
189
Option('versioned', help='Only show versioned files')]
172
Option('short', help='Give short SVN-style status lines.'),
173
Option('versioned', help='Only show versioned files.')]
190
174
aliases = ['st', 'stat']
192
176
encoding_type = 'replace'
193
_see_also = ['diff', 'revert']
177
_see_also = ['diff', 'revert', 'status-flags']
196
180
def run(self, show_ids=False, file_list=None, revision=None, short=False,
355
339
into a subdirectory of this one.
357
341
takes_args = ['file*']
358
takes_options = ['no-recurse', 'dry-run', 'verbose',
359
Option('file-ids-from', type=unicode,
360
help='Lookup file ids from here')]
344
help="Don't recursively add the contents of directories."),
346
help="Show what would be done, but don't actually do anything."),
348
Option('file-ids-from',
350
help='Lookup file ids from this tree.'),
361
352
encoding_type = 'replace'
362
353
_see_also = ['remove']
385
376
base_tree.lock_read()
387
added, ignored = bzrlib.add.smart_add(file_list, not no_recurse,
388
action=action, save=not dry_run)
378
file_list = self._maybe_expand_globs(file_list)
380
tree = WorkingTree.open_containing(file_list[0])[0]
382
tree = WorkingTree.open_containing(u'.')[0]
383
added, ignored = tree.smart_add(file_list, not
384
no_recurse, action=action, save=not dry_run)
390
386
if base_tree is not None:
391
387
base_tree.unlock()
450
446
_see_also = ['ls']
451
takes_options = ['revision', 'show-ids', 'kind']
451
help='List entries of a particular kind: file, directory, symlink.',
452
454
takes_args = ['file*']
455
457
def run(self, revision=None, show_ids=False, kind=None, file_list=None):
456
458
if kind and kind not in ['file', 'directory', 'symlink']:
457
raise errors.BzrCommandError('invalid kind specified')
459
raise errors.BzrCommandError('invalid kind %r specified' % (kind,))
459
461
work_tree, file_list = tree_files(file_list)
460
462
work_tree.lock_read()
565
567
location can be accessed.
568
_see_also = ['push', 'update']
570
_see_also = ['push', 'update', 'status-flags']
569
571
takes_options = ['remember', 'overwrite', 'revision', 'verbose',
570
572
Option('directory',
571
help='branch to pull into, '
572
'rather than the one containing the working directory',
573
help='Branch to pull into, '
574
'rather than the one containing the working directory.',
676
678
takes_options = ['remember', 'overwrite', 'verbose',
677
679
Option('create-prefix',
678
680
help='Create the path leading up to the branch '
679
'if it does not already exist'),
681
'if it does not already exist.'),
680
682
Option('directory',
681
help='branch to push from, '
682
'rather than the one containing the working directory',
683
help='Branch to push from, '
684
'rather than the one containing the working directory.',
686
688
Option('use-existing-dir',
687
689
help='By default push will fail if the target'
688
690
' directory exists, but does not already'
689
' have a control directory. This flag will'
691
' have a control directory. This flag will'
690
692
' allow push to proceed.'),
692
694
takes_args = ['location?']
1022
1023
tree.lock_tree_write()
1024
1025
existing_pending_merges = tree.get_parent_ids()[1:]
1025
last_rev = tree.last_revision()
1026
if last_rev == tree.branch.last_revision():
1026
last_rev = _mod_revision.ensure_null(tree.last_revision())
1027
if last_rev == _mod_revision.ensure_null(
1028
tree.branch.last_revision()):
1027
1029
# may be up to date, check master too.
1028
1030
master = tree.branch.get_master_branch()
1029
if master is None or last_rev == master.last_revision():
1031
if master is None or last_rev == _mod_revision.ensure_null(
1032
master.last_revision()):
1030
1033
revno = tree.branch.revision_id_to_revno(last_rev)
1031
1034
note("Tree is up to date at revision %d." % (revno,))
1033
conflicts = tree.update()
1034
revno = tree.branch.revision_id_to_revno(tree.last_revision())
1036
conflicts = tree.update(delta._ChangeReporter(
1037
unversioned_filter=tree.is_ignored))
1038
revno = tree.branch.revision_id_to_revno(
1039
_mod_revision.ensure_null(tree.last_revision()))
1035
1040
note('Updated to revision %d.' % (revno,))
1036
1041
if tree.get_parent_ids()[1:] != existing_pending_merges:
1037
1042
note('Your local commits will now show as pending merges with '
1336
1341
takes_args = ["location"]
1337
1342
takes_options = [RegistryOption('format',
1338
1343
help='Specify a format for this repository. See'
1339
' "bzr help formats" for details',
1344
' "bzr help formats" for details.',
1340
1345
registry=bzrdir.format_registry,
1341
1346
converter=bzrdir.format_registry.make_bzrdir,
1342
1347
value_switches=True, title='Repository format'),
1343
1348
Option('no-trees',
1344
1349
help='Branches in the repository will default to'
1345
' not having a working tree'),
1350
' not having a working tree.'),
1347
1352
aliases = ["init-repo"]
1398
1403
_see_also = ['status']
1399
1404
takes_args = ['file*']
1400
takes_options = ['revision', 'diff-options',
1406
Option('diff-options', type=str,
1407
help='Pass these options to the external diff program.'),
1401
1408
Option('prefix', type=str,
1402
1409
short_name='p',
1403
1410
help='Set prefixes to added to old and new filenames, as '
1404
'two values separated by a colon. (eg "old/:new/")'),
1411
'two values separated by a colon. (eg "old/:new/").'),
1406
1414
aliases = ['di', 'dif']
1407
1415
encoding_type = 'exact'
1592
1600
# TODO: Make --revision support uuid: and hash: [future tag:] notation.
1594
1602
takes_args = ['location?']
1595
takes_options = [Option('forward',
1596
help='show from oldest to newest'),
1600
help='show files changed in each revision'),
1601
'show-ids', 'revision',
1605
help='show revisions whose message matches this regexp',
1608
help='limit the output to the first N revisions',
1605
help='Show from oldest to newest.'),
1608
help='Display timezone as local, original, or utc.'),
1611
help='Show files changed in each revision.'),
1617
help='Show revisions whose message matches this '
1618
'regular expression.',
1621
help='Limit the output to the first N revisions.',
1611
1625
encoding_type = 'replace'
1613
1627
@display_command
1665
1679
raise errors.BzrCommandError(
1666
1680
"Log doesn't accept two revisions in different"
1668
if revision[0].spec is None:
1669
# missing begin-range means first revision
1672
rev1 = revision[0].in_history(b).revno
1674
if revision[1].spec is None:
1675
# missing end-range means last known revision
1678
rev2 = revision[1].in_history(b).revno
1682
rev1 = revision[0].in_history(b)
1683
rev2 = revision[1].in_history(b)
1680
1685
raise errors.BzrCommandError(
1681
1686
'bzr log --revision takes one or two values.')
1683
# By this point, the revision numbers are converted to the +ve
1684
# form if they were supplied in the -ve form, so we can do
1685
# this comparison in relative safety
1687
(rev2, rev1) = (rev1, rev2)
1689
1688
if log_format is None:
1690
1689
log_format = log.log_formatter_registry.get_default(b)
1741
1740
_see_also = ['status', 'cat']
1742
1741
takes_args = ['path?']
1743
1742
# TODO: Take a revision or remote path and list that tree instead.
1744
takes_options = ['verbose', 'revision',
1745
Option('non-recursive',
1746
help='don\'t recurse into sub-directories'),
1748
help='Print all paths from the root of the branch.'),
1749
Option('unknown', help='Print unknown files'),
1750
Option('versioned', help='Print versioned files'),
1751
Option('ignored', help='Print ignored files'),
1753
Option('null', help='Null separate the files'),
1746
Option('non-recursive',
1747
help='Don\'t recurse into subdirectories.'),
1749
help='Print paths relative to the root of the branch.'),
1750
Option('unknown', help='Print unknown files.'),
1751
Option('versioned', help='Print versioned files.'),
1752
Option('ignored', help='Print ignored files.'),
1754
help='Write an ascii NUL (\\0) separator '
1755
'between files rather than a newline.'),
1757
help='List entries of a particular kind: file, directory, symlink.',
1756
1761
@display_command
1757
def run(self, revision=None, verbose=False,
1762
def run(self, revision=None, verbose=False,
1758
1763
non_recursive=False, from_root=False,
1759
1764
unknown=False, versioned=False, ignored=False,
1760
1765
null=False, kind=None, show_ids=False, path=None):
2121
2137
_see_also = ['bugs', 'uncommit']
2122
2138
takes_args = ['selected*']
2123
takes_options = ['message', 'verbose',
2125
help='commit even if nothing has changed'),
2126
Option('file', type=str,
2129
help='file containing commit message'),
2131
help="refuse to commit if there are unknown "
2132
"files in the working tree."),
2133
ListOption('fixes', type=str,
2134
help="mark a bug as being fixed by this "
2137
help="perform a local only commit in a bound "
2138
"branch. Such commits are not pushed to "
2139
"the master branch until a normal commit "
2140
Option('message', type=unicode,
2142
help="Description of the new revision."),
2145
help='Commit even if nothing has changed.'),
2146
Option('file', type=str,
2149
help='Take commit message from this file.'),
2151
help="Refuse to commit if there are unknown "
2152
"files in the working tree."),
2153
ListOption('fixes', type=str,
2154
help="Mark a bug as being fixed by this revision."),
2156
help="Perform a local commit in a bound "
2157
"branch. Local commits are not pushed to "
2158
"the master branch until a normal commit "
2143
2162
aliases = ['ci', 'checkin']
2145
2164
def _get_bug_fix_properties(self, fixes, branch):
2386
2405
modified by plugins will not be tested, and tests provided by plugins will
2408
Tests that need working space on disk use a common temporary directory,
2409
typically inside $TMPDIR or /tmp.
2390
2412
bzr selftest ignore
2391
2413
run only tests relating to 'ignore'
2392
2414
bzr --no-plugins selftest -v
2393
2415
disable plugins and list tests as they're run
2395
For each test, that needs actual disk access, bzr create their own
2396
subdirectory in the temporary testing directory (testXXXX.tmp).
2397
By default the name of such subdirectory is based on the name of the test.
2398
If option '--numbered-dirs' is given, bzr will use sequent numbers
2399
of running tests to create such subdirectories. This is default behavior
2400
on Windows because of path length limitation.
2402
2417
# NB: this is used from the class without creating an instance, which is
2403
2418
# why it does not have a self parameter.
2420
2435
takes_args = ['testspecs*']
2421
2436
takes_options = ['verbose',
2423
help='stop when one test fails',
2438
help='Stop when one test fails.',
2424
2439
short_name='1',
2426
Option('keep-output',
2427
help='keep output directories when tests fail'),
2428
2441
Option('transport',
2429
2442
help='Use a different transport by default '
2430
2443
'throughout the test suite.',
2431
2444
type=get_transport_type),
2432
Option('benchmark', help='run the bzr benchmarks.'),
2446
help='Run the benchmarks rather than selftests.'),
2433
2447
Option('lsprof-timed',
2434
help='generate lsprof output for benchmarked'
2448
help='Generate lsprof output for benchmarked'
2435
2449
' sections of code.'),
2436
2450
Option('cache-dir', type=str,
2437
help='a directory to cache intermediate'
2438
' benchmark steps'),
2439
Option('clean-output',
2440
help='clean temporary tests directories'
2441
' without running tests'),
2451
help='Cache intermediate benchmark output in this '
2442
2453
Option('first',
2443
help='run all tests, but run specified tests first',
2454
help='Run all tests, but run specified tests first.',
2444
2455
short_name='f',
2446
Option('numbered-dirs',
2447
help='use numbered dirs for TestCaseInTempDir'),
2448
2457
Option('list-only',
2449
help='list the tests instead of running them'),
2458
help='List the tests instead of running them.'),
2450
2459
Option('randomize', type=str, argname="SEED",
2451
help='randomize the order of tests using the given'
2452
' seed or "now" for the current time'),
2460
help='Randomize the order of tests using the given'
2461
' seed or "now" for the current time.'),
2453
2462
Option('exclude', type=str, argname="PATTERN",
2454
2463
short_name='x',
2455
help='exclude tests that match this regular'
2464
help='Exclude tests that match this regular'
2458
2467
encoding_type = 'replace'
2460
2469
def run(self, testspecs_list=None, verbose=None, one=False,
2461
keep_output=False, transport=None, benchmark=None,
2462
lsprof_timed=None, cache_dir=None, clean_output=False,
2463
first=False, numbered_dirs=None, list_only=False,
2470
transport=None, benchmark=None,
2471
lsprof_timed=None, cache_dir=None,
2472
first=False, list_only=False,
2464
2473
randomize=None, exclude=None):
2465
2474
import bzrlib.ui
2466
2475
from bzrlib.tests import selftest
2467
2476
import bzrlib.benchmarks as benchmarks
2468
2477
from bzrlib.benchmarks import tree_creator
2471
from bzrlib.tests import clean_selftest_output
2472
clean_selftest_output()
2475
warning("notice: selftest --keep-output "
2476
"is no longer supported; "
2477
"test output is always removed")
2479
if numbered_dirs is None and sys.platform == 'win32':
2480
numbered_dirs = True
2482
2479
if cache_dir is not None:
2483
2480
tree_creator.TreeCreator.CACHE_ROOT = osutils.abspath(cache_dir)
2484
2481
print '%10s: %s' % ('bzr', osutils.realpath(sys.argv[0]))
2609
2605
--force is given.
2612
_see_also = ['update', 'remerge']
2608
_see_also = ['update', 'remerge', 'status-flags']
2613
2609
takes_args = ['branch?']
2614
takes_options = ['revision', 'force', 'merge-type', 'reprocess', 'remember',
2613
help='Merge even if the destination tree has uncommitted changes.'),
2615
2617
Option('show-base', help="Show base revision text in "
2617
2619
Option('uncommitted', help='Apply uncommitted changes'
2618
' from a working copy, instead of branch changes'),
2620
' from a working copy, instead of branch changes.'),
2619
2621
Option('pull', help='If the destination is already'
2620
2622
' completely merged into the source, pull from the'
2621
' source rather than merging. When this happens,'
2623
' source rather than merging. When this happens,'
2622
2624
' you do not need to commit the result.'),
2623
2625
Option('directory',
2624
help='Branch to merge into, '
2625
'rather than the one containing the working directory',
2626
help='Branch to merge into, '
2627
'rather than the one containing the working directory.',
2631
2633
def run(self, branch=None, revision=None, force=False, merge_type=None,
2969
2979
_see_also = ['merge', 'pull']
2970
2980
takes_args = ['other_branch?']
2971
takes_options = [Option('reverse', 'Reverse the order of revisions'),
2973
'Display changes in the local branch only'),
2974
Option('this' , 'same as --mine-only'),
2975
Option('theirs-only',
2976
'Display changes in the remote branch only'),
2977
Option('other', 'same as --theirs-only'),
2982
Option('reverse', 'Reverse the order of revisions.'),
2984
'Display changes in the local branch only.'),
2985
Option('this' , 'Same as --mine-only.'),
2986
Option('theirs-only',
2987
'Display changes in the remote branch only.'),
2988
Option('other', 'Same as --theirs-only.'),
2982
2993
encoding_type = 'replace'
2984
2995
@display_command
3080
3107
class cmd_testament(Command):
3081
3108
"""Show testament (signing-form) of a revision."""
3082
takes_options = ['revision',
3083
Option('long', help='Produce long-format testament'),
3084
Option('strict', help='Produce a strict-format'
3111
Option('long', help='Produce long-format testament.'),
3113
help='Produce a strict-format testament.')]
3086
3114
takes_args = ['branch?']
3087
3115
@display_command
3088
3116
def run(self, branch=u'.', revision=None, long=False, strict=False):
3121
3149
# with new uncommitted lines marked
3122
3150
aliases = ['ann', 'blame', 'praise']
3123
3151
takes_args = ['filename']
3124
takes_options = [Option('all', help='show annotations on all lines'),
3125
Option('long', help='show date in annotations'),
3152
takes_options = [Option('all', help='Show annotations on all lines.'),
3153
Option('long', help='Show commit date in annotations.'),
3157
encoding_type = 'exact'
3130
3159
@display_command
3131
3160
def run(self, filename, all=False, long=False, revision=None,
3143
3172
revision_id = revision[0].in_history(branch).rev_id
3144
3173
file_id = tree.path2id(relpath)
3175
raise errors.NotVersionedError(filename)
3145
3176
tree = branch.repository.revision_tree(revision_id)
3146
3177
file_version = tree.inventory[file_id].revision
3147
annotate_file(branch, file_version, file_id, long, all, sys.stdout,
3178
annotate_file(branch, file_version, file_id, long, all, self.outf,
3148
3179
show_ids=show_ids)
3150
3181
branch.unlock()
3366
3397
takes_options = [
3368
help='serve on stdin/out for use from inetd or sshd'),
3399
help='Serve on stdin/out for use from inetd or sshd.'),
3370
help='listen for connections on nominated port of the form '
3371
'[hostname:]portnumber. Passing 0 as the port number will '
3372
'result in a dynamically allocated port. Default port is '
3401
help='Listen for connections on nominated port of the form '
3402
'[hostname:]portnumber. Passing 0 as the port number will '
3403
'result in a dynamically allocated port. The default port is '
3375
3406
Option('directory',
3376
help='serve contents of directory',
3407
help='Serve contents of this directory.',
3378
3409
Option('allow-writes',
3379
help='By default the server is a readonly server. Supplying '
3410
help='By default the server is a readonly server. Supplying '
3380
3411
'--allow-writes enables write access to the contents of '
3381
'the served directory and below. '
3412
'the served directory and below.'
3525
3558
takes_options = [
3526
3559
RegistryOption.from_kwargs('patch-type',
3527
3560
'The type of patch to include in the directive',
3528
title='Patch type', value_switches=True, enum_switch=False,
3529
bundle='Bazaar revision bundle (default)',
3530
diff='Normal unified diff',
3531
plain='No patch, just directive'),
3532
Option('sign', help='GPG-sign the directive'), 'revision',
3562
value_switches=True,
3564
bundle='Bazaar revision bundle (default).',
3565
diff='Normal unified diff.',
3566
plain='No patch, just directive.'),
3567
Option('sign', help='GPG-sign the directive.'), 'revision',
3533
3568
Option('mail-to', type=str,
3534
help='Instead of printing the directive, email to this address'),
3569
help='Instead of printing the directive, email to this address.'),
3535
3570
Option('message', type=str, short_name='m',
3536
help='Message to use when committing this merge')
3571
help='Message to use when committing this merge.')
3539
3574
encoding_type = 'exact'