~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_log.py

  • Committer: John Arbash Meinel
  • Date: 2009-03-26 16:35:00 UTC
  • mfrom: (4208 +trunk)
  • mto: (3735.40.9 vilajam)
  • mto: This revision was merged to the branch mainline in revision 4280.
  • Revision ID: john@arbash-meinel.com-20090326163500-os7lvdpsdxnxstd0
Merge bzr.dev 4208.

This brings in some more smart-server improvements, 
as well as the iter_files_bytes as chunked, and 
multi-file and directory logging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
255
255
            ": nothing to repeat\n", err)
256
256
        self.assertEqual('', out)
257
257
 
 
258
 
258
259
class TestLogVerbose(TestCaseWithTransport):
259
260
 
260
261
    def setUp(self):
985
986
        self.assertNotContainsRe(log, '^3:', re.MULTILINE)
986
987
        self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE)
987
988
        self.assertNotContainsRe(log, '^4:', re.MULTILINE)
 
989
 
 
990
 
 
991
class TestLogMultiple(TestCaseWithTransport):
 
992
 
 
993
    def prepare_tree(self):
 
994
        tree = self.make_branch_and_tree('parent')
 
995
        self.build_tree([
 
996
            'parent/file1',
 
997
            'parent/file2',
 
998
            'parent/dir1/',
 
999
            'parent/dir1/file5',
 
1000
            'parent/dir1/dir2/',
 
1001
            'parent/dir1/dir2/file3',
 
1002
            'parent/file4'])
 
1003
        tree.add('file1')
 
1004
        tree.commit('add file1')
 
1005
        tree.add('file2')
 
1006
        tree.commit('add file2')
 
1007
        tree.add(['dir1', 'dir1/dir2', 'dir1/dir2/file3'])
 
1008
        tree.commit('add file3')
 
1009
        tree.add('file4')
 
1010
        tree.commit('add file4')
 
1011
        tree.add('dir1/file5')
 
1012
        tree.commit('add file5')
 
1013
        child_tree = tree.bzrdir.sprout('child').open_workingtree()
 
1014
        self.build_tree_contents([('child/file2', 'hello')])
 
1015
        child_tree.commit(message='branch 1')
 
1016
        tree.merge_from_branch(child_tree.branch)
 
1017
        tree.commit(message='merge child branch')
 
1018
        os.chdir('parent')
 
1019
 
 
1020
    def assertRevnos(self, paths_str, expected_revnos):
 
1021
        # confirm the revision numbers in log --line output are those expected
 
1022
        out, err = self.run_bzr('log --line -n0 %s' % (paths_str,))
 
1023
        self.assertEqual('', err)
 
1024
        revnos = [s.split(':', 1)[0].lstrip() for s in out.splitlines()]
 
1025
        self.assertEqual(expected_revnos, revnos)
 
1026
 
 
1027
    def test_log_files(self):
 
1028
        """The log for multiple file should only list revs for those files"""
 
1029
        self.prepare_tree()
 
1030
        self.assertRevnos('file1 file2 dir1/dir2/file3',
 
1031
            ['6', '5.1.1', '3', '2', '1'])
 
1032
 
 
1033
    def test_log_directory(self):
 
1034
        """The log for a directory should show all nested files."""
 
1035
        self.prepare_tree()
 
1036
        self.assertRevnos('dir1', ['5', '3'])
 
1037
 
 
1038
    def test_log_nested_directory(self):
 
1039
        """The log for a directory should show all nested files."""
 
1040
        self.prepare_tree()
 
1041
        self.assertRevnos('dir1/dir2', ['3'])
 
1042
 
 
1043
    def test_log_in_nested_directory(self):
 
1044
        """The log for a directory should show all nested files."""
 
1045
        self.prepare_tree()
 
1046
        os.chdir("dir1")
 
1047
        self.assertRevnos('.', ['5', '3'])
 
1048
 
 
1049
    def test_log_files_and_directories(self):
 
1050
        """Logging files and directories together should be fine."""
 
1051
        self.prepare_tree()
 
1052
        self.assertRevnos('file4 dir1/dir2', ['4', '3'])
 
1053
 
 
1054
    def test_log_files_and_dirs_in_nested_directory(self):
 
1055
        """The log for a directory should show all nested files."""
 
1056
        self.prepare_tree()
 
1057
        os.chdir("dir1")
 
1058
        self.assertRevnos('dir2 file5', ['5', '3'])