~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_version_info.py

(jameinel) (bug #780544) when updating the WT,
 allow it to be done with a fast delta,
 rather than setting the state from scratch. (John A Meinel)

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 
54
54
        return wt
55
55
 
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
56
    def test_rio_null(self):
76
57
        wt = self.make_branch_and_tree('branch')
77
58
 
82
63
        self.assertContainsRe(val, 'build-date:')
83
64
        self.assertContainsRe(val, 'revno: 0')
84
65
 
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
66
    def test_rio_version_text(self):
95
67
        wt = self.create_branch()
96
68
 
219
191
        builder.generate(sio)
220
192
        val = sio.getvalue()
221
193
        self.assertContainsRe(val, "'revision_id': None")
222
 
        self.assertContainsRe(val, "'revno': '0'")
 
194
        self.assertContainsRe(val, "'revno': 0")
223
195
        self.assertNotContainsString(val, '\n\n\n\n')
224
196
 
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'")
233
 
 
234
197
    def test_python_version(self):
235
198
        wt = self.create_branch()
236
199
 
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
228
        self.assertTrue(tvi.version_info.has_key('date'))
266
229
        self.assertEqual(None, tvi.version_info['clean'])
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