~fginther/jenkins-launchpad-plugin/config-file-trigger

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import logging

from bzrlib.plugin import load_plugins
load_plugins()
from bzrlib import branch as bzr_branch
from tarmac.branch import Branch as TarmacBranch
from tarmac.branch import BranchConfig
from settings import LAUNCHPAD_LOGIN


class Branch(TarmacBranch):
    def __init__(self, lp_branch, config=False, target=None):
        self.lp_branch = lp_branch
        self.branch_url = ('bzr+ssh://' + LAUNCHPAD_LOGIN +
                           '@bazaar.launchpad.net/' +
                            self.lp_branch.unique_name)
        self.bzr_branch = bzr_branch.Branch.open(self.branch_url)
        if config:
            self.config = BranchConfig(lp_branch, config)
        else:
            self.config = None

        self.target = target
        self.logger = logging.getLogger('jenkins-launchpad-plugin')