~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Author(s): Mark Hammond
  • Date: 2008-09-09 17:02:21 UTC
  • mto: This revision was merged to the branch mainline in revision 3697.
  • Revision ID: john@arbash-meinel.com-20080909170221-svim3jw2mrz0amp3
An updated transparent icon for bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2008, 2009, 2011, 2016 Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""Tests for revision properties."""
18
18
 
19
 
from bzrlib.tests.per_repository import (
 
19
from bzrlib.tests.repository_implementations.test_repository import (
20
20
    TestCaseWithRepository,
21
21
    )
22
22
 
31
31
                     condiment='orange\n  mint\n\tcandy',
32
32
                     empty='',
33
33
                     non_ascii=u'\xb5')
34
 
        wt.commit(message='initial null commit',
 
34
        wt.commit(message='initial null commit', 
35
35
                 revprops=props,
36
36
                 allow_pointless=True,
37
37
                 rev_id='test@user-1')
38
38
        rev = b.repository.get_revision('test@user-1')
39
39
        self.assertTrue('flavor' in rev.properties)
40
 
        self.assertEqual(rev.properties['flavor'], 'choc-mint')
41
 
        self.assertEqual([('branch-nick', 'Nicholas'),
 
40
        self.assertEquals(rev.properties['flavor'], 'choc-mint')
 
41
        self.assertEquals([('branch-nick', 'Nicholas'), 
42
42
                           ('condiment', 'orange\n  mint\n\tcandy'),
43
43
                           ('empty', ''),
44
44
                           ('flavor', 'choc-mint'),
50
50
        wt = self.make_branch_and_tree('.')
51
51
        b = wt.branch
52
52
        self.assertRaises(ValueError,
53
 
                          wt.commit,
 
53
                          wt.commit, 
54
54
                          message='invalid',
55
55
                          revprops={'what a silly property': 'fine'})
56
56
        self.assertRaises(ValueError,
57
 
                          wt.commit,
 
57
                          wt.commit, 
58
58
                          message='invalid',
59
59
                          revprops=dict(number=13))
60
60
 
63
63
    """Test that revision attributes are correct."""
64
64
 
65
65
    def test_revision_accessors(self):
66
 
        """Make sure the values that come out of a revision are the
 
66
        """Make sure the values that come out of a revision are the 
67
67
        same as the ones that go in.
68
68
        """
69
69
        tree1 = self.make_branch_and_tree("br1")
70
70
 
71
71
        # create a revision
72
 
        rev1 = tree1.commit(message="quux", allow_pointless=True,
73
 
            committer="jaq",
74
 
            revprops={'empty':'',
75
 
                      'value':'one',
76
 
                      'unicode':u'\xb5',
77
 
                      'multiline':'foo\nbar\n\n'
78
 
                      })
79
 
        self.assertEqual(tree1.branch.last_revision(), rev1)
 
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
        self.assertTrue(len(tree1.branch.revision_history()) > 0)
80
79
        rev_a = tree1.branch.repository.get_revision(
81
80
                            tree1.branch.last_revision())
82
81
 
92
91
                     verbose=True)
93
92
        rev_b = tree2.branch.repository.get_revision(
94
93
                            tree2.branch.last_revision())
95
 
 
 
94
        
96
95
        self.assertEqual(rev_a.message, rev_b.message)
97
96
        self.assertEqual(rev_a.timestamp, rev_b.timestamp)
98
97
        self.assertEqual(rev_a.timezone, rev_b.timezone)