Example #1
0
 def regen(self, wt, tpl, **kwargs):
     sio = StringIO()
     builder = CustomVersionInfoBuilder(wt.branch, working_tree=wt,
                                        template=tpl, **kwargs)
     builder.generate(sio)
     val = sio.getvalue()
     return val
Example #2
0
 def test_custom_dotted_revno(self):
     sio = StringIO()
     wt = self.create_tree_with_dotted_revno()
     builder = CustomVersionInfoBuilder(wt.branch, working_tree=wt, 
         template='{revno} revid: {revision_id}')
     builder.generate(sio)
     self.assertEqual("1.1.1 revid: o2", sio.getvalue())
Example #3
0
 def regen(tpl, **kwargs):
     sio = StringIO()
     builder = CustomVersionInfoBuilder(wt.branch, working_tree=wt,
                                        template=tpl, **kwargs)
     builder.generate(sio)
     val = sio.getvalue()
     return val
Example #4
0
 def test_custom_dotted_revno(self):
     sio = StringIO()
     wt = self.create_tree_with_dotted_revno()
     builder = CustomVersionInfoBuilder(wt.branch, working_tree=wt, 
         template='{revno} revid: {revision_id}')
     builder.generate(sio)
     self.assertEquals("1.1.1 revid: o2", sio.getvalue())
Example #5
0
    def test_custom_null(self):
        sio = StringIO()
        wt = self.make_branch_and_tree('branch')
        builder = CustomVersionInfoBuilder(wt.branch, working_tree=wt,
            template='revno: {revno}')
        builder.generate(sio)
        self.assertEquals("revno: 0", sio.getvalue())

        builder = CustomVersionInfoBuilder(wt.branch, working_tree=wt, 
            template='{revno} revid: {revision_id}')
        # revision_id is not available yet
        self.assertRaises(errors.MissingTemplateVariable, 
            builder.generate, sio)
Example #6
0
    def test_custom_null(self):
        sio = StringIO()
        wt = self.make_branch_and_tree('branch')
        builder = CustomVersionInfoBuilder(wt.branch, working_tree=wt,
            template='revno: {revno}')
        builder.generate(sio)
        self.assertEqual("revno: 0", sio.getvalue())

        builder = CustomVersionInfoBuilder(wt.branch, working_tree=wt, 
            template='{revno} revid: {revision_id}')
        # revision_id is not available yet
        self.assertRaises(errors.MissingTemplateVariable, 
            builder.generate, sio)
Example #7
0
 def test_custom_without_template(self):
     builder = CustomVersionInfoBuilder(None)
     sio = StringIO()
     self.assertRaises(errors.NoTemplate, builder.generate, sio)