def processUpdatedRepo(conduit, path, remote, mailer):
    clone = phlsys_git.GitClone(path)
    remote_branches = phlgit_branch.get_remote(clone, remote)
    gitContext = abdt_gittypes.GitContext(clone, remote, remote_branches)
    wbList = abdt_naming.getWorkingBranches(remote_branches)
    makeRb = abdt_naming.makeReviewBranchNameFromWorkingBranch
    rbDict = dict((makeRb(wb), wb) for wb in wbList)

    processAbandonedBranches(conduit, clone, remote, wbList, remote_branches)

    for b in remote_branches:
        if abdt_naming.isReviewBranchPrefixed(b):
            review_branch = abdt_naming.makeReviewBranchFromName(b)
            if review_branch is None:
                # TODO: handle this case properly
                continue

            review_branch = abdt_gittypes.makeGitReviewBranch(
                review_branch, remote)
            working_branch = None
            if b in rbDict.keys():
                working_branch = rbDict[b]
                working_branch = abdt_gittypes.makeGitWorkingBranch(
                    working_branch, remote)
            processUpdatedBranch(
                mailer, conduit, gitContext, review_branch, working_branch)
Ejemplo n.º 2
0
    def _add_paired_branches(
            self, paired, branches, rb_to_wb, lander):
        for b in branches:
            if abdt_naming.isReviewBranchPrefixed(b):
                review_branch = abdt_naming.makeReviewBranchFromName(b)
                if review_branch is None:
                    # TODO: handle this case properly
                    continue

                review_branch = abdt_gittypes.makeGitReviewBranch(
                    review_branch, self._remote)
                working_branch = None
                if b in rb_to_wb.keys():
                    working_branch = rb_to_wb[b]
                    working_branch = abdt_gittypes.makeGitWorkingBranch(
                        working_branch, self._remote)

                branch_url = None
                if self._branch_link_callable:
                    branch_url = self._branch_link_callable(review_branch)

                paired.append(
                    abdt_branch.Branch(
                        self,
                        review_branch,
                        working_branch,
                        lander,
                        self._description,
                        branch_url))
    def _setup_for_untracked_branch(self, repo_name='name', branch_url=None):
        self._create_new_file(self.repo_dev, 'README')
        self.repo_dev.call('add', 'README')
        self.repo_dev.call('commit', '-m', 'initial commit')
        phlgit_push.push(self.repo_dev, 'master', 'origin')

        base = 'master'
        description = 'untracked'

        branch_name = abdt_naming.makeReviewBranchName(description, base)
        self.repo_dev.call('checkout', '-b', branch_name)
        phlgit_push.push(self.repo_dev, branch_name, 'origin')

        self.clone_arcyd.call('fetch', 'origin')
        review_branch = abdt_naming.makeReviewBranchFromName(branch_name)
        review_branch = abdt_gittypes.makeGitReviewBranch(
            review_branch, 'origin')
        branch = abdt_branch.Branch(
            self.clone_arcyd,
            review_branch,
            None,
            None,
            repo_name,
            branch_url)

        # should not raise
        branch.verify_review_branch_base()

        return base, branch_name, branch