437
445
_see_also = ['ls']
438
takes_options = ['revision', 'show-ids', 'kind']
450
help='List entries of a particular kind: file, directory, symlink.',
439
453
takes_args = ['file*']
442
456
def run(self, revision=None, show_ids=False, kind=None, file_list=None):
443
457
if kind and kind not in ['file', 'directory', 'symlink']:
444
raise errors.BzrCommandError('invalid kind specified')
458
raise errors.BzrCommandError('invalid kind %r specified' % (kind,))
446
460
work_tree, file_list = tree_files(file_list)
447
461
work_tree.lock_read()
665
679
takes_options = ['remember', 'overwrite', 'verbose',
666
680
Option('create-prefix',
667
681
help='Create the path leading up to the branch '
668
'if it does not already exist'),
682
'if it does not already exist.'),
669
683
Option('directory',
670
help='branch to push from, '
671
'rather than the one containing the working directory',
684
help='Branch to push from, '
685
'rather than the one containing the working directory.',
675
689
Option('use-existing-dir',
676
690
help='By default push will fail if the target'
677
691
' directory exists, but does not already'
678
' have a control directory. This flag will'
692
' have a control directory. This flag will'
679
693
' allow push to proceed.'),
681
695
takes_args = ['location?']
1011
1024
tree.lock_tree_write()
1013
1026
existing_pending_merges = tree.get_parent_ids()[1:]
1014
last_rev = tree.last_revision()
1015
if last_rev == tree.branch.last_revision():
1027
last_rev = _mod_revision.ensure_null(tree.last_revision())
1028
if last_rev == _mod_revision.ensure_null(
1029
tree.branch.last_revision()):
1016
1030
# may be up to date, check master too.
1017
1031
master = tree.branch.get_master_branch()
1018
if master is None or last_rev == master.last_revision():
1032
if master is None or last_rev == _mod_revision.ensure_null(
1033
master.last_revision()):
1019
1034
revno = tree.branch.revision_id_to_revno(last_rev)
1020
1035
note("Tree is up to date at revision %d." % (revno,))
1022
1037
conflicts = tree.update(delta._ChangeReporter(
1023
1038
unversioned_filter=tree.is_ignored))
1024
revno = tree.branch.revision_id_to_revno(tree.last_revision())
1039
revno = tree.branch.revision_id_to_revno(
1040
_mod_revision.ensure_null(tree.last_revision()))
1025
1041
note('Updated to revision %d.' % (revno,))
1026
1042
if tree.get_parent_ids()[1:] != existing_pending_merges:
1027
1043
note('Your local commits will now show as pending merges with '
1326
1342
takes_args = ["location"]
1327
1343
takes_options = [RegistryOption('format',
1328
1344
help='Specify a format for this repository. See'
1329
' "bzr help formats" for details',
1345
' "bzr help formats" for details.',
1330
1346
registry=bzrdir.format_registry,
1331
1347
converter=bzrdir.format_registry.make_bzrdir,
1332
1348
value_switches=True, title='Repository format'),
1333
1349
Option('no-trees',
1334
1350
help='Branches in the repository will default to'
1335
' not having a working tree'),
1351
' not having a working tree.'),
1337
1353
aliases = ["init-repo"]
1582
1601
# TODO: Make --revision support uuid: and hash: [future tag:] notation.
1584
1603
takes_args = ['location?']
1585
takes_options = [Option('forward',
1586
help='show from oldest to newest'),
1590
help='show files changed in each revision'),
1591
'show-ids', 'revision',
1595
help='show revisions whose message matches this regexp',
1598
help='limit the output to the first N revisions',
1606
help='Show from oldest to newest.'),
1609
help='Display timezone as local, original, or utc.'),
1612
help='Show files changed in each revision.'),
1618
help='Show revisions whose message matches this '
1619
'regular expression.',
1622
help='Limit the output to the first N revisions.',
1601
1626
encoding_type = 'replace'
1603
1628
@display_command
1716
1741
_see_also = ['status', 'cat']
1717
1742
takes_args = ['path?']
1718
1743
# TODO: Take a revision or remote path and list that tree instead.
1719
takes_options = ['verbose', 'revision',
1720
Option('non-recursive',
1721
help='don\'t recurse into sub-directories'),
1723
help='Print all paths from the root of the branch.'),
1724
Option('unknown', help='Print unknown files'),
1725
Option('versioned', help='Print versioned files'),
1726
Option('ignored', help='Print ignored files'),
1728
Option('null', help='Null separate the files'),
1747
Option('non-recursive',
1748
help='Don\'t recurse into subdirectories.'),
1750
help='Print paths relative to the root of the branch.'),
1751
Option('unknown', help='Print unknown files.'),
1752
Option('versioned', help='Print versioned files.'),
1753
Option('ignored', help='Print ignored files.'),
1755
help='Write an ascii NUL (\\0) separator '
1756
'between files rather than a newline.'),
1758
help='List entries of a particular kind: file, directory, symlink.',
1731
1762
@display_command
1732
def run(self, revision=None, verbose=False,
1763
def run(self, revision=None, verbose=False,
1733
1764
non_recursive=False, from_root=False,
1734
1765
unknown=False, versioned=False, ignored=False,
1735
1766
null=False, kind=None, show_ids=False, path=None):
2096
2138
_see_also = ['bugs', 'uncommit']
2097
2139
takes_args = ['selected*']
2098
takes_options = ['message', 'verbose',
2100
help='commit even if nothing has changed'),
2101
Option('file', type=str,
2104
help='file containing commit message'),
2106
help="refuse to commit if there are unknown "
2107
"files in the working tree."),
2108
ListOption('fixes', type=str,
2109
help="mark a bug as being fixed by this "
2112
help="perform a local only commit in a bound "
2113
"branch. Such commits are not pushed to "
2114
"the master branch until a normal commit "
2141
Option('message', type=unicode,
2143
help="Description of the new revision."),
2146
help='Commit even if nothing has changed.'),
2147
Option('file', type=str,
2150
help='Take commit message from this file.'),
2152
help="Refuse to commit if there are unknown "
2153
"files in the working tree."),
2154
ListOption('fixes', type=str,
2155
help="Mark a bug as being fixed by this revision."),
2157
help="Perform a local commit in a bound "
2158
"branch. Local commits are not pushed to "
2159
"the master branch until a normal commit "
2118
2163
aliases = ['ci', 'checkin']
2120
2165
def _get_bug_fix_properties(self, fixes, branch):
2361
2406
modified by plugins will not be tested, and tests provided by plugins will
2409
Tests that need working space on disk use a common temporary directory,
2410
typically inside $TMPDIR or /tmp.
2365
2413
bzr selftest ignore
2366
2414
run only tests relating to 'ignore'
2367
2415
bzr --no-plugins selftest -v
2368
2416
disable plugins and list tests as they're run
2370
For each test, that needs actual disk access, bzr create their own
2371
subdirectory in the temporary testing directory (testXXXX.tmp).
2372
By default the name of such subdirectory is based on the name of the test.
2373
If option '--numbered-dirs' is given, bzr will use sequent numbers
2374
of running tests to create such subdirectories. This is default behavior
2375
on Windows because of path length limitation.
2377
2418
# NB: this is used from the class without creating an instance, which is
2378
2419
# why it does not have a self parameter.
2395
2436
takes_args = ['testspecs*']
2396
2437
takes_options = ['verbose',
2398
help='stop when one test fails',
2439
help='Stop when one test fails.',
2399
2440
short_name='1',
2401
Option('keep-output',
2402
help='keep output directories when tests fail'),
2403
2442
Option('transport',
2404
2443
help='Use a different transport by default '
2405
2444
'throughout the test suite.',
2406
2445
type=get_transport_type),
2407
Option('benchmark', help='run the bzr benchmarks.'),
2447
help='Run the benchmarks rather than selftests.'),
2408
2448
Option('lsprof-timed',
2409
help='generate lsprof output for benchmarked'
2449
help='Generate lsprof output for benchmarked'
2410
2450
' sections of code.'),
2411
2451
Option('cache-dir', type=str,
2412
help='a directory to cache intermediate'
2413
' benchmark steps'),
2414
Option('clean-output',
2415
help='clean temporary tests directories'
2416
' without running tests'),
2452
help='Cache intermediate benchmark output in this '
2417
2454
Option('first',
2418
help='run all tests, but run specified tests first',
2455
help='Run all tests, but run specified tests first.',
2419
2456
short_name='f',
2421
Option('numbered-dirs',
2422
help='use numbered dirs for TestCaseInTempDir'),
2423
2458
Option('list-only',
2424
help='list the tests instead of running them'),
2459
help='List the tests instead of running them.'),
2425
2460
Option('randomize', type=str, argname="SEED",
2426
help='randomize the order of tests using the given'
2427
' seed or "now" for the current time'),
2461
help='Randomize the order of tests using the given'
2462
' seed or "now" for the current time.'),
2428
2463
Option('exclude', type=str, argname="PATTERN",
2429
2464
short_name='x',
2430
help='exclude tests that match this regular'
2465
help='Exclude tests that match this regular'
2433
2468
encoding_type = 'replace'
2435
2470
def run(self, testspecs_list=None, verbose=None, one=False,
2436
keep_output=False, transport=None, benchmark=None,
2437
lsprof_timed=None, cache_dir=None, clean_output=False,
2438
first=False, numbered_dirs=None, list_only=False,
2471
transport=None, benchmark=None,
2472
lsprof_timed=None, cache_dir=None,
2473
first=False, list_only=False,
2439
2474
randomize=None, exclude=None):
2440
2475
import bzrlib.ui
2441
2476
from bzrlib.tests import selftest
2442
2477
import bzrlib.benchmarks as benchmarks
2443
2478
from bzrlib.benchmarks import tree_creator
2446
from bzrlib.tests import clean_selftest_output
2447
clean_selftest_output()
2450
warning("notice: selftest --keep-output "
2451
"is no longer supported; "
2452
"test output is always removed")
2454
if numbered_dirs is None and sys.platform == 'win32':
2455
numbered_dirs = True
2479
from bzrlib.version import show_version
2457
2481
if cache_dir is not None:
2458
2482
tree_creator.TreeCreator.CACHE_ROOT = osutils.abspath(cache_dir)
2459
print '%10s: %s' % ('bzr', osutils.realpath(sys.argv[0]))
2460
print '%10s: %s' % ('bzrlib', bzrlib.__path__[0])
2484
show_version(show_config=False, show_copyright=False)
2462
2486
if testspecs_list is not None:
2463
2487
pattern = '|'.join(testspecs_list)
2587
2610
_see_also = ['update', 'remerge', 'status-flags']
2588
2611
takes_args = ['branch?']
2589
takes_options = ['revision', 'force', 'merge-type', 'reprocess', 'remember',
2615
help='Merge even if the destination tree has uncommitted changes.'),
2590
2619
Option('show-base', help="Show base revision text in "
2592
2621
Option('uncommitted', help='Apply uncommitted changes'
2593
' from a working copy, instead of branch changes'),
2622
' from a working copy, instead of branch changes.'),
2594
2623
Option('pull', help='If the destination is already'
2595
2624
' completely merged into the source, pull from the'
2596
' source rather than merging. When this happens,'
2625
' source rather than merging. When this happens,'
2597
2626
' you do not need to commit the result.'),
2598
2627
Option('directory',
2599
help='Branch to merge into, '
2600
'rather than the one containing the working directory',
2628
help='Branch to merge into, '
2629
'rather than the one containing the working directory.',
2606
2635
def run(self, branch=None, revision=None, force=False, merge_type=None,
2953
2990
_see_also = ['merge', 'pull']
2954
2991
takes_args = ['other_branch?']
2955
takes_options = [Option('reverse', 'Reverse the order of revisions'),
2957
'Display changes in the local branch only'),
2958
Option('this' , 'same as --mine-only'),
2959
Option('theirs-only',
2960
'Display changes in the remote branch only'),
2961
Option('other', 'same as --theirs-only'),
2993
Option('reverse', 'Reverse the order of revisions.'),
2995
'Display changes in the local branch only.'),
2996
Option('this' , 'Same as --mine-only.'),
2997
Option('theirs-only',
2998
'Display changes in the remote branch only.'),
2999
Option('other', 'Same as --theirs-only.'),
2966
3004
encoding_type = 'replace'
2968
3006
@display_command
3064
3118
class cmd_testament(Command):
3065
3119
"""Show testament (signing-form) of a revision."""
3066
takes_options = ['revision',
3067
Option('long', help='Produce long-format testament'),
3068
Option('strict', help='Produce a strict-format'
3122
Option('long', help='Produce long-format testament.'),
3124
help='Produce a strict-format testament.')]
3070
3125
takes_args = ['branch?']
3071
3126
@display_command
3072
3127
def run(self, branch=u'.', revision=None, long=False, strict=False):
3105
3160
# with new uncommitted lines marked
3106
3161
aliases = ['ann', 'blame', 'praise']
3107
3162
takes_args = ['filename']
3108
takes_options = [Option('all', help='show annotations on all lines'),
3109
Option('long', help='show date in annotations'),
3163
takes_options = [Option('all', help='Show annotations on all lines.'),
3164
Option('long', help='Show commit date in annotations.'),
3168
encoding_type = 'exact'
3114
3170
@display_command
3115
3171
def run(self, filename, all=False, long=False, revision=None,
3352
3408
takes_options = [
3354
help='serve on stdin/out for use from inetd or sshd'),
3410
help='Serve on stdin/out for use from inetd or sshd.'),
3356
help='listen for connections on nominated port of the form '
3357
'[hostname:]portnumber. Passing 0 as the port number will '
3358
'result in a dynamically allocated port. Default port is '
3412
help='Listen for connections on nominated port of the form '
3413
'[hostname:]portnumber. Passing 0 as the port number will '
3414
'result in a dynamically allocated port. The default port is '
3361
3417
Option('directory',
3362
help='serve contents of directory',
3418
help='Serve contents of this directory.',
3364
3420
Option('allow-writes',
3365
help='By default the server is a readonly server. Supplying '
3421
help='By default the server is a readonly server. Supplying '
3366
3422
'--allow-writes enables write access to the contents of '
3367
'the served directory and below. '
3423
'the served directory and below.'
3515
3573
takes_options = [
3516
3574
RegistryOption.from_kwargs('patch-type',
3517
3575
'The type of patch to include in the directive',
3518
title='Patch type', value_switches=True, enum_switch=False,
3519
bundle='Bazaar revision bundle (default)',
3520
diff='Normal unified diff',
3521
plain='No patch, just directive'),
3522
Option('sign', help='GPG-sign the directive'), 'revision',
3577
value_switches=True,
3579
bundle='Bazaar revision bundle (default).',
3580
diff='Normal unified diff.',
3581
plain='No patch, just directive.'),
3582
Option('sign', help='GPG-sign the directive.'), 'revision',
3523
3583
Option('mail-to', type=str,
3524
help='Instead of printing the directive, email to this address'),
3584
help='Instead of printing the directive, email to this address.'),
3525
3585
Option('message', type=str, short_name='m',
3526
help='Message to use when committing this merge')
3586
help='Message to use when committing this merge.')
3529
3589
encoding_type = 'exact'
3620
3680
takes_args = ['submit_branch?', 'public_branch?']
3621
3681
takes_options = [
3622
3682
Option('no-bundle',
3623
help='Do not include a bundle in the merge directive'),
3683
help='Do not include a bundle in the merge directive.'),
3624
3684
Option('no-patch', help='Do not include a preview patch in the merge'
3626
3686
Option('remember',
3627
help='Remember submit and public branch'),
3687
help='Remember submit and public branch.'),
3629
help='branch to generate the submission from, '
3630
'rather than the one containing the working directory',
3689
help='Branch to generate the submission from, '
3690
'rather than the one containing the working directory.',
3631
3691
short_name='f',
3633
Option('output', short_name='o', help='Write directive to this file',
3693
Option('output', short_name='o', help='Write directive to this file.',