499
504
self.runbzr('pull ../a --remember')
500
505
self.runbzr('pull')
502
def test_add_reports(self):
503
"""add command prints the names of added files."""
505
self.build_tree(['top.txt', 'dir/', 'dir/sub.txt', 'CVS'])
506
out = self.run_bzr_captured(['add'], retcode=0)[0]
507
# the ordering is not defined at the moment
508
results = sorted(out.rstrip('\n').split('\n'))
509
self.assertEquals(['If you wish to add some of these files, please'\
510
' add them by name.',
514
'ignored 1 file(s) matching "CVS"'],
516
out = self.run_bzr_captured(['add', '-v'], retcode=0)[0]
517
results = sorted(out.rstrip('\n').split('\n'))
518
self.assertEquals(['If you wish to add some of these files, please'\
519
' add them by name.',
520
'ignored CVS matching "CVS"'],
523
def test_add_quiet_is(self):
524
"""add -q does not print the names of added files."""
526
self.build_tree(['top.txt', 'dir/', 'dir/sub.txt'])
527
out = self.run_bzr_captured(['add', '-q'], retcode=0)[0]
528
# the ordering is not defined at the moment
529
results = sorted(out.rstrip('\n').split('\n'))
530
self.assertEquals([''], results)
532
def test_add_in_unversioned(self):
533
"""Try to add a file in an unversioned directory.
535
"bzr add" should add the parent(s) as necessary.
538
self.build_tree(['inertiatic/', 'inertiatic/esp'])
539
self.assertEquals(self.capture('unknowns'), 'inertiatic\n')
540
self.run_bzr('add', 'inertiatic/esp')
541
self.assertEquals(self.capture('unknowns'), '')
543
# Multiple unversioned parents
544
self.build_tree(['veil/', 'veil/cerpin/', 'veil/cerpin/taxt'])
545
self.assertEquals(self.capture('unknowns'), 'veil\n')
546
self.run_bzr('add', 'veil/cerpin/taxt')
547
self.assertEquals(self.capture('unknowns'), '')
549
# Check whacky paths work
550
self.build_tree(['cicatriz/', 'cicatriz/esp'])
551
self.assertEquals(self.capture('unknowns'), 'cicatriz\n')
552
self.run_bzr('add', 'inertiatic/../cicatriz/esp')
553
self.assertEquals(self.capture('unknowns'), '')
555
def test_add_in_versioned(self):
556
"""Try to add a file in a versioned directory.
558
"bzr add" should do this happily.
561
self.build_tree(['inertiatic/', 'inertiatic/esp'])
562
self.assertEquals(self.capture('unknowns'), 'inertiatic\n')
563
self.run_bzr('add', '--no-recurse', 'inertiatic')
564
self.assertEquals(self.capture('unknowns'), 'inertiatic/esp\n')
565
self.run_bzr('add', 'inertiatic/esp')
566
self.assertEquals(self.capture('unknowns'), '')
568
def test_subdir_add(self):
569
"""Add in subdirectory should add only things from there down"""
570
from bzrlib.workingtree import WorkingTree
572
eq = self.assertEqual
576
t = self.make_branch_and_tree('.')
578
self.build_tree(['src/', 'README'])
580
eq(sorted(t.unknowns()),
583
self.run_bzr('add', 'src')
585
self.build_tree(['src/foo.c'])
590
self.assertEquals(self.capture('unknowns'), 'README\n')
591
eq(len(t.read_working_inventory()), 3)
595
self.assertEquals(self.capture('unknowns'), '')
596
self.run_bzr('check')
598
507
def test_unknown_command(self):
599
508
"""Handling of unknown command."""
600
509
out, err = self.run_bzr_captured(['fluffy-badger'],