~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_version_info.py

  • Committer: Vincent Ladeuil
  • Date: 2010-10-07 06:08:01 UTC
  • mto: This revision was merged to the branch mainline in revision 5491.
  • Revision ID: v.ladeuil+lp@free.fr-20101007060801-wfdhizfhfmctl8qa
Fix some typos and propose a release planning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005, 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
24
24
from bzrlib import (
25
25
    errors,
26
26
    registry,
 
27
    symbol_versioning,
27
28
    tests,
28
29
    version_info_formats,
29
30
    )
53
54
 
54
55
        return wt
55
56
 
56
 
    def create_tree_with_dotted_revno(self):
57
 
        wt = self.make_branch_and_tree('branch')
58
 
        self.build_tree(['branch/a'])
59
 
        wt.add('a')
60
 
        wt.commit('a', rev_id='r1')
61
 
 
62
 
        other = wt.bzrdir.sprout('other').open_workingtree()
63
 
        self.build_tree(['other/b.a'])
64
 
        other.add(['b.a'])
65
 
        other.commit('b.a', rev_id='o2')
66
 
 
67
 
        os.chdir('branch')
68
 
        self.run_bzr('merge ../other')
69
 
        wt.commit('merge', rev_id='merge')
70
 
 
71
 
        wt.update(revision='o2')
72
 
 
73
 
        return wt
74
 
 
75
57
    def test_rio_null(self):
76
58
        wt = self.make_branch_and_tree('branch')
77
59
 
82
64
        self.assertContainsRe(val, 'build-date:')
83
65
        self.assertContainsRe(val, 'revno: 0')
84
66
 
85
 
    def test_rio_dotted_revno(self):
86
 
        wt = self.create_tree_with_dotted_revno()
87
 
 
88
 
        sio = StringIO()
89
 
        builder = RioVersionInfoBuilder(wt.branch, working_tree=wt)
90
 
        builder.generate(sio)
91
 
        val = sio.getvalue()
92
 
        self.assertContainsRe(val, 'revno: 1.1.1')
93
 
 
94
67
    def test_rio_version_text(self):
95
68
        wt = self.create_branch()
96
69
 
164
137
            return new_stanzas[0]
165
138
 
166
139
        stanza = regen()
167
 
        self.assertTrue('date' in stanza)
168
 
        self.assertTrue('build-date' in stanza)
 
140
        self.failUnless('date' in stanza)
 
141
        self.failUnless('build-date' in stanza)
169
142
        self.assertEqual(['3'], stanza.get_all('revno'))
170
143
        self.assertEqual(['r3'], stanza.get_all('revision-id'))
171
144
 
219
192
        builder.generate(sio)
220
193
        val = sio.getvalue()
221
194
        self.assertContainsRe(val, "'revision_id': None")
222
 
        self.assertContainsRe(val, "'revno': '0'")
223
 
        self.assertNotContainsString(val, '\n\n\n\n')
224
 
 
225
 
    def test_python_dotted_revno(self):
226
 
        wt = self.create_tree_with_dotted_revno()
227
 
 
228
 
        sio = StringIO()
229
 
        builder = PythonVersionInfoBuilder(wt.branch, working_tree=wt)
230
 
        builder.generate(sio)
231
 
        val = sio.getvalue()
232
 
        self.assertContainsRe(val, "'revno': '1.1.1'")
 
195
        self.assertContainsRe(val, "'revno': 0")
233
196
 
234
197
    def test_python_version(self):
235
198
        wt = self.create_branch()
260
223
            return tvi
261
224
 
262
225
        tvi = regen()
263
 
        self.assertEqual('3', tvi.version_info['revno'])
 
226
        self.assertEqual(3, tvi.version_info['revno'])
264
227
        self.assertEqual('r3', tvi.version_info['revision_id'])
265
 
        self.assertTrue(tvi.version_info.has_key('date'))
 
228
        self.failUnless(tvi.version_info.has_key('date'))
266
229
        self.assertEqual(None, tvi.version_info['clean'])
267
230
 
268
231
        tvi = regen(check_for_clean=True)
320
283
        self.assertRaises(errors.MissingTemplateVariable, 
321
284
            builder.generate, sio)
322
285
 
323
 
    def test_custom_dotted_revno(self):
324
 
        sio = StringIO()
325
 
        wt = self.create_tree_with_dotted_revno()
326
 
        builder = CustomVersionInfoBuilder(wt.branch, working_tree=wt, 
327
 
            template='{revno} revid: {revision_id}')
328
 
        builder.generate(sio)
329
 
        self.assertEquals("1.1.1 revid: o2", sio.getvalue())
330
 
 
331
286
    def test_custom_version_text(self):
332
287
        wt = self.create_branch()
333
288