~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branchbuilder.py

  • Committer: Jelmer Vernooij
  • Date: 2009-03-12 14:02:53 UTC
  • mfrom: (4135 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4137.
  • Revision ID: jelmer@samba.org-20090312140253-bmldbzlmsitfdrzf
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007 Canonical Ltd
 
1
# Copyright (C) 2007, 2009 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
59
59
            'commit 1',
60
60
            branch.repository.get_revision(branch.last_revision()).message)
61
61
 
 
62
    def test_build_commit_timestamp(self):
 
63
        """You can set a date when committing."""
 
64
        builder = self.make_branch_builder('foo')
 
65
        rev_id = builder.build_commit(timestamp=1236043340)
 
66
        branch = builder.get_branch()
 
67
        self.assertEqual((1, rev_id), branch.last_revision_info())
 
68
        rev = branch.repository.get_revision(branch.last_revision())
 
69
        self.assertEqual(
 
70
            'commit 1',
 
71
            rev.message)
 
72
        self.assertEqual(
 
73
            1236043340,
 
74
            int(rev.timestamp))
 
75
 
62
76
    def test_build_two_commits(self):
63
77
        """The second commit has the right parents and message."""
64
78
        builder = BranchBuilder(self.get_transport().clone('foo'))
130
144
                              (u'b', 'b-id', 'directory'),
131
145
                             ], rev_tree)
132
146
 
 
147
    def test_commit_timestamp(self):
 
148
        builder = self.make_branch_builder('foo')
 
149
        rev_id = builder.build_snapshot(None, None,
 
150
            [('add', (u'', None, 'directory', None))],
 
151
            timestamp=1234567890)
 
152
        rev = builder.get_branch().repository.get_revision(rev_id)
 
153
        self.assertEqual(
 
154
            1234567890,
 
155
            int(rev.timestamp))
 
156
 
133
157
    def test_commit_message_default(self):
134
158
        builder = BranchBuilder(self.get_transport().clone('foo'))
135
159
        rev_id = builder.build_snapshot(None, None,