~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_version_info.py

  • Committer: Jelmer Vernooij
  • Date: 2009-04-03 21:23:55 UTC
  • mto: This revision was merged to the branch mainline in revision 4252.
  • Revision ID: jelmer@samba.org-20090403212355-z81946ra1auxlkme
Fix version-info in empty branches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 
54
54
        return wt
55
55
 
 
56
    def test_rio_null(self):
 
57
        wt = self.make_branch_and_tree('branch')
 
58
 
 
59
        sio = StringIO()
 
60
        builder = RioVersionInfoBuilder(wt.branch, working_tree=wt)
 
61
        builder.generate(sio)
 
62
        val = sio.getvalue()
 
63
        self.assertContainsRe(val, 'build-date:')
 
64
        self.assertContainsRe(val, 'revno: 0')
 
65
 
56
66
    def test_rio_version_text(self):
57
67
        wt = self.create_branch()
58
68
 
154
164
        self.assertEqual(['r4', 'r4', 'unversioned', 'removed'],
155
165
                         file_rev_stanza.get_all('revision'))
156
166
 
 
167
    def test_python_null(self):
 
168
        wt = self.make_branch_and_tree('branch')
 
169
 
 
170
        sio = StringIO()
 
171
        builder = PythonVersionInfoBuilder(wt.branch, working_tree=wt)
 
172
        builder.generate(sio)
 
173
        val = sio.getvalue()
 
174
        self.assertContainsRe(val, "'revision_id': None")
 
175
        self.assertContainsRe(val, "'revno': 0")
 
176
 
157
177
    def test_python_version(self):
158
178
        wt = self.create_branch()
159
179
 
229
249
        self.assertEqual('unversioned', tvi.file_revisions['c'])
230
250
        self.assertEqual('removed', tvi.file_revisions['d'])
231
251
 
 
252
    def test_custom_null(self):
 
253
        sio = StringIO()
 
254
        wt = self.make_branch_and_tree('branch')
 
255
        builder = CustomVersionInfoBuilder(wt.branch, working_tree=wt,
 
256
            template='revno: {revno}')
 
257
        builder.generate(sio)
 
258
        self.assertEquals("revno: 0", sio.getvalue())
 
259
 
 
260
        builder = CustomVersionInfoBuilder(wt.branch, working_tree=wt, 
 
261
            template='{revno} revid: {revision_id}')
 
262
        # revision_id is not available yet
 
263
        self.assertRaises(errors.MissingTemplateVariable, 
 
264
            builder.generate, sio)
 
265
 
232
266
    def test_custom_version_text(self):
233
267
        wt = self.create_branch()
234
268