コード例 #1
0
def open_repo(team):
    """
    Open the team repository.

    TODO: Check the logged in user has permission to do this.
    """
    repoLoc = srusers.get_svnrepo( team )
    return bzrlib.repository.Repository.open(repoLoc)
コード例 #2
0
def open_branch(team, project):
    """
    Open the project branch for the team.

    TODO: Check the logged in user has permission to do this!
    """
    repoLoc = srusers.get_svnrepo( team )
    branchloc = repoLoc + "/" + project
    return bzrlib.branch.Branch.open(branchloc)
コード例 #3
0
    def createproj(self, name, team):
        """Creates new project directory"""

        r = open_repo(int(team))

        if name.find(".") != -1:
            """No ../../ nastyness"""
            return nil

        url = srusers.get_svnrepo(team) + "/" + name

        r.bzrdir.create_branch_convenience(base=url, force_new_tree=False)

        return dict()
コード例 #4
0
    def __init__(self, team, project):

        # First open the branch
        repo = srusers.get_svnrepo( team ) # TODO BZRPORT: do we want Repo to be a string?
        branchloc = repo + "/" + project
        b = bzrlib.branch.Branch.open(branchloc)

        # Create a temporary directory
        tmpdir = tempfile.mkdtemp()

        # Lightweight checkout into the temp directory
        b.create_checkout(tmpdir, lightweight=True)

        # Open checkout as working tree object
        wt = bzrlib.workingtree.WorkingTree.open(tmpdir)

        #Using self.__dict__[] to avoid calling setattr in recursive death
        self.__dict__["workingtree"] = wt
        self.__dict__["tmpdir"] = tmpdir