579
def test_pull_verbose(self):
580
"""Pull changes from one branch to another and watch the output."""
586
self.example_branch()
591
open('b', 'wb').write('else\n')
593
bzr(['commit', '-m', 'added b'])
596
out = bzr('pull --verbose ../b', backtick=True)
597
self.failIfEqual(out.find('Added Revisions:'), -1)
598
self.failIfEqual(out.find('message:\n added b'), -1)
599
self.failIfEqual(out.find('added:\n b'), -1)
601
# Check that --overwrite --verbose prints out the removed entries
602
bzr('commit -m foo --unchanged')
604
bzr('commit -m baz --unchanged')
605
bzr('pull ../a', retcode=1)
606
out = bzr('pull --overwrite --verbose ../a', backtick=1)
608
remove_loc = out.find('Removed Revisions:')
609
self.failIfEqual(remove_loc, -1)
610
added_loc = out.find('Added Revisions:')
611
self.failIfEqual(added_loc, -1)
613
removed_message = out.find('message:\n baz')
614
self.failIfEqual(removed_message, -1)
615
self.failUnless(remove_loc < removed_message < added_loc)
617
added_message = out.find('message:\n foo')
618
self.failIfEqual(added_message, -1)
619
self.failUnless(added_loc < added_message)
579
621
def test_locations(self):
580
622
"""Using and remembering different locations"""
758
800
# nothing missing
759
801
self.runbzr('missing ../missing/new-branch')
803
def test_external_command(self):
804
"""test that external commands can be run by setting the path"""
805
cmd_name = 'test-command'
806
output = 'Hello from test-command'
807
if sys.platform == 'win32':
813
oldpath = os.environ.get('BZRPATH', None)
818
if os.environ.has_key('BZRPATH'):
819
del os.environ['BZRPATH']
821
f = file(cmd_name, 'wb')
822
if sys.platform == 'win32':
823
f.write('@echo off\n')
825
f.write('#!/bin/sh\n')
826
f.write('echo Hello from test-command')
828
os.chmod(cmd_name, 0755)
830
# It should not find the command in the local
831
# directory by default, since it is not in my path
832
bzr(cmd_name, retcode=1)
834
# Now put it into my path
835
os.environ['BZRPATH'] = '.'
838
# The test suite does not capture stdout for external commands
839
# this is because you have to have a real file object
840
# to pass to Popen(stdout=FOO), and StringIO is not one of those.
841
# (just replacing sys.stdout does not change a spawned objects stdout)
842
#self.assertEquals(bzr(cmd_name), output)
844
# Make sure empty path elements are ignored
845
os.environ['BZRPATH'] = os.pathsep
847
bzr(cmd_name, retcode=1)
851
os.environ['BZRPATH'] = oldpath
762
854
def listdir_sorted(dir):
763
855
L = os.listdir(dir)