~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/repository_implementations/test_revision.py

merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
                          wt.commit, 
58
58
                          message='invalid',
59
59
                          revprops=dict(number=13))
 
60
 
 
61
 
 
62
class TestRevisionAttributes(TestCaseWithRepository):
 
63
    """Test that revision attributes are correct."""
 
64
 
 
65
    def test_revision_accessors(self):
 
66
        """Make sure the values that come out of a revision are the 
 
67
        same as the ones that go in.
 
68
        """
 
69
        tree1 = self.make_branch_and_tree("br1")
 
70
 
 
71
        # create a revision
 
72
        tree1.commit(message="quux", allow_pointless=True, committer="jaq",
 
73
                     revprops={'empty':'',
 
74
                               'value':'one',
 
75
                               'unicode':'\xb5',
 
76
                               'multiline':'foo\nbar\n\n'
 
77
                              })
 
78
        assert len(tree1.branch.revision_history()) > 0
 
79
        rev_a = tree1.branch.repository.get_revision(
 
80
                            tree1.branch.last_revision())
 
81
 
 
82
        tree2 = self.make_branch_and_tree("br2")
 
83
        tree2.commit(message=rev_a.message,
 
84
                     timestamp=rev_a.timestamp,
 
85
                     timezone=rev_a.timezone,
 
86
                     committer=rev_a.committer,
 
87
                     rev_id=rev_a.revision_id,
 
88
                     revprops=rev_a.properties,
 
89
                     allow_pointless=True, # there's nothing in this commit
 
90
                     strict=True,
 
91
                     verbose=True)
 
92
        rev_b = tree2.branch.repository.get_revision(
 
93
                            tree2.branch.last_revision())
 
94
        
 
95
        self.assertEqual(rev_a.message, rev_b.message)
 
96
        self.assertEqual(rev_a.timestamp, rev_b.timestamp)
 
97
        self.assertEqual(rev_a.timezone, rev_b.timezone)
 
98
        self.assertEqual(rev_a.committer, rev_b.committer)
 
99
        self.assertEqual(rev_a.revision_id, rev_b.revision_id)
 
100
        self.assertEqual(rev_a.properties, rev_b.properties)
 
101
 
 
102
    def test_zero_timezone(self):
 
103
        tree1 = self.make_branch_and_tree("br1")
 
104
 
 
105
        # create a revision
 
106
        tree1.commit(message="quux", timezone=0, rev_id='r1')
 
107
        rev_a = tree1.branch.repository.get_revision('r1')
 
108
        self.assertEqual(0, rev_a.timezone)