1587
1587
_see_also = ['status', 'ls']
1590
help='Write an ascii NUL (\\0) separator '
1591
'between files rather than a newline.')
1589
1594
@display_command
1595
def run(self, null=False):
1591
1596
tree = WorkingTree.open_containing(u'.')[0]
1592
1597
td = tree.changes_from(tree.basis_tree())
1593
1598
for path, id, kind, text_modified, meta_modified in td.modified:
1594
self.outf.write(path + '\n')
1600
self.outf.write(path + '\0')
1602
self.outf.write(osutils.quotefn(path) + '\n')
1597
1605
class cmd_added(Command):
1602
1610
_see_also = ['status', 'ls']
1613
help='Write an ascii NUL (\\0) separator '
1614
'between files rather than a newline.')
1604
1617
@display_command
1618
def run(self, null=False):
1606
1619
wt = WorkingTree.open_containing(u'.')[0]
1619
1632
path = inv.id2path(file_id)
1620
1633
if not os.access(osutils.abspath(path), os.F_OK):
1622
self.outf.write(path + '\n')
1636
self.outf.write(path + '\0')
1638
self.outf.write(osutils.quotefn(path) + '\n')
1820
1836
Option('from-root',
1821
1837
help='Print paths relative to the root of the branch.'),
1822
1838
Option('unknown', help='Print unknown files.'),
1823
Option('versioned', help='Print versioned files.'),
1839
Option('versioned', help='Print versioned files.',
1824
1841
Option('ignored', help='Print ignored files.'),
1826
1843
help='Write an ascii NUL (\\0) separator '
2540
2557
print branch.nick
2560
class cmd_alias(Command):
2561
"""Set/unset and display aliases.
2564
Show the current aliases::
2568
Show the alias specified for 'll'::
2572
Set an alias for 'll'::
2574
bzr alias ll="log --line -r-10..-1"
2576
To remove an alias for 'll'::
2578
bzr alias --remove ll
2581
takes_args = ['name?']
2583
Option('remove', help='Remove the alias.'),
2586
def run(self, name=None, remove=False):
2588
self.remove_alias(name)
2590
self.print_aliases()
2592
equal_pos = name.find('=')
2594
self.print_alias(name)
2596
self.set_alias(name[:equal_pos], name[equal_pos+1:])
2598
def remove_alias(self, alias_name):
2599
if alias_name is None:
2600
raise errors.BzrCommandError(
2601
'bzr alias --remove expects an alias to remove.')
2602
# If alias is not found, print something like:
2603
# unalias: foo: not found
2604
c = config.GlobalConfig()
2605
c.unset_alias(alias_name)
2608
def print_aliases(self):
2609
"""Print out the defined aliases in a similar format to bash."""
2610
aliases = config.GlobalConfig().get_aliases()
2611
for key, value in sorted(aliases.iteritems()):
2612
self.outf.write('bzr alias %s="%s"\n' % (key, value))
2615
def print_alias(self, alias_name):
2616
from bzrlib.commands import get_alias
2617
alias = get_alias(alias_name)
2619
self.outf.write("bzr alias: %s: not found\n" % alias_name)
2622
'bzr alias %s="%s"\n' % (alias_name, ' '.join(alias)))
2624
def set_alias(self, alias_name, alias_command):
2625
"""Save the alias in the global config."""
2626
c = config.GlobalConfig()
2627
c.set_alias(alias_name, alias_command)
2543
2630
class cmd_selftest(Command):
2544
2631
"""Run internal test suite.
2638
2725
help='Load a test id list from a text file.'),
2639
2726
ListOption('debugflag', type=str, short_name='E',
2640
2727
help='Turn on a selftest debug flag.'),
2728
Option('starting-with', type=str, argname='TESTID',
2730
help='Load only the tests starting with TESTID.'),
2642
2732
encoding_type = 'replace'
2646
2736
lsprof_timed=None, cache_dir=None,
2647
2737
first=False, list_only=False,
2648
2738
randomize=None, exclude=None, strict=False,
2649
load_list=None, debugflag=None):
2739
load_list=None, debugflag=None, starting_with=None):
2650
2740
import bzrlib.ui
2651
2741
from bzrlib.tests import selftest
2652
2742
import bzrlib.benchmarks as benchmarks
2653
2743
from bzrlib.benchmarks import tree_creator
2745
# Make deprecation warnings visible, unless -Werror is set
2746
symbol_versioning.activate_deprecation_warnings(override=False)
2655
2748
if cache_dir is not None:
2656
2749
tree_creator.TreeCreator.CACHE_ROOT = osutils.abspath(cache_dir)
2657
2750
if not list_only:
3304
3398
from bzrlib.missing import find_unmerged, iter_log_revisions
3404
# TODO: We should probably check that we don't have mine-only and
3405
# theirs-only set, but it gets complicated because we also have
3406
# this and other which could be used.
3311
3413
local_branch = Branch.open_containing(u".")[0]
3312
3414
parent = local_branch.get_parent()
3327
3429
remote_branch.lock_read()
3329
local_extra, remote_extra = find_unmerged(local_branch,
3431
local_extra, remote_extra = find_unmerged(
3432
local_branch, remote_branch, restrict)
3331
3434
if log_format is None:
3332
3435
registry = log.log_formatter_registry
3333
3436
log_format = registry.get_default(local_branch)
3335
3438
show_ids=show_ids,
3336
3439
show_timezone='original')
3337
3440
if reverse is False:
3338
local_extra.reverse()
3339
remote_extra.reverse()
3441
if local_extra is not None:
3442
local_extra.reverse()
3443
if remote_extra is not None:
3444
remote_extra.reverse()
3340
3447
if local_extra and not theirs_only:
3341
3448
self.outf.write("You have %d extra revision(s):\n" %
3342
3449
len(local_extra))
3356
3465
remote_branch.repository,
3358
3467
lf.log_revision(revision)
3359
if not remote_extra and not local_extra:
3470
if mine_only and not local_extra:
3471
# We checked local, and found nothing extra
3472
self.outf.write('This branch is up to date.\n')
3473
elif theirs_only and not remote_extra:
3474
# We checked remote, and found nothing extra
3475
self.outf.write('Other branch is up to date.\n')
3476
elif not (mine_only or theirs_only or local_extra or
3478
# We checked both branches, and neither one had extra
3361
3480
self.outf.write("Branches are up to date.\n")
3365
3482
remote_branch.unlock()