def getDatabaseBranch(self, personName, productName, branchName): """Look up and return the specified branch from the database.""" owner = Person.byName(personName) if productName is None: product = None else: product = Product.selectOneBy(name=productName) namespace = get_branch_namespace(owner, product) return namespace.getByName(branchName)
def test_push_to_new_short_branch_alias(self): # We can also push branches to URLs like /+branch/firefox # Hack 'firefox' so we have permission to do this. ZopelessAppServerLayer.txn.begin() firefox = Product.selectOneBy(name='firefox') testuser = Person.selectOneBy(name='testuser') firefox.development_focus.owner = testuser ZopelessAppServerLayer.txn.commit() remote_url = self.getTransportURL('+branch/firefox') self.push(self.local_branch_path, remote_url) self.assertBranchesMatch(self.local_branch_path, remote_url)
def makeDatabaseBranch(self, owner_name, product_name, branch_name, branch_type=BranchType.HOSTED): """Create a new branch in the database.""" owner = Person.selectOneBy(name=owner_name) if product_name == '+junk': product = None else: product = Product.selectOneBy(name=product_name) if branch_type == BranchType.MIRRORED: url = 'http://example.com' else: url = None namespace = get_branch_namespace(owner, product) return namespace.createBranch( branch_type=branch_type, name=branch_name, registrant=owner, url=url)
def getProduct(self, name): return Product.selectOneBy(projectgroup=self, name=name)
def getProduct(self, name): return Product.selectOneBy(project=self, name=name)