def test_substitute(self): source =self.make_branch_and_tree("source") revid1 = source.commit("one") source.commit("two") branch1 = BaseRecipeBranch("source", "{revno}-{revno:packaging}", 0.2, revspec="1") branch2 = RecipeBranch("packaging", "source") branch1.nest_branch("debian", branch2) self.assertEqual(True, resolve_revisions(branch1, substitute_branch_vars=substitute_branch_vars)) self.assertEqual("source", branch1.url) self.assertEqual(revid1, branch1.revid) self.assertEqual("1", branch1.revspec) self.assertEqual("1-2", branch1.deb_version)
def test_changed_shape(self): source =self.make_branch_and_tree("source") revid = source.commit("one") branch1 = BaseRecipeBranch("source", "{revno}", 0.2, revspec="1") branch2 = BaseRecipeBranch("source", "{revno}", 0.2, revspec="revid:%s" % revid) branch3 = RecipeBranch("nested", "source") branch1.nest_branch("foo", branch3) self.assertEqual(True, resolve_revisions(branch1, if_changed_from=branch2, substitute_branch_vars=substitute_branch_vars)) self.assertEqual("source", branch1.url) self.assertEqual(revid, branch1.revid) self.assertEqual("1", branch1.revspec) self.assertEqual("1", branch1.deb_version)
def test_unchanged_multilevel(self): source =self.make_branch_and_tree("source") revid = source.commit("one") branch1 = BaseRecipeBranch("source", "{revno}", 0.2) branch2 = RecipeBranch("nested1", "source") branch3 = RecipeBranch("nested2", "source") branch2.nest_branch("bar", branch3) branch1.nest_branch("foo", branch2) branch4 = BaseRecipeBranch("source", "{revno}", 0.2, revspec="revid:%s" % revid) branch5 = RecipeBranch("nested1", "source", revspec="revid:%s" % revid) branch6 = RecipeBranch("nested2", "source", revspec="revid:%s" % revid) branch5.nest_branch("bar", branch6) branch4.nest_branch("foo", branch5) self.assertEqual(False, resolve_revisions(branch1, if_changed_from=branch4, substitute_branch_vars=substitute_branch_vars)) self.assertEqual("source", branch1.url) self.assertEqual(revid, branch1.revid) self.assertEqual(None, branch1.revspec) self.assertEqual("1", branch1.deb_version)