def _push_new_status_branch(gitContext, review_branch, status, revision_id):
    clone = gitContext.clone
    remote = gitContext.remote

    if revision_id is None:
        revision_id = "none"
    else:
        revision_id = str(revision_id)

    working_branch_name = abdt_naming.makeWorkingBranchName(
        status,
        review_branch.description,
        review_branch.base,
        revision_id)

    working_branch = abdt_naming.makeWorkingBranchFromName(
        working_branch_name)

    working_branch = abdt_gittypes.makeGitWorkingBranch(
        working_branch, gitContext.remote)

    phlgit_push.push_asymmetrical_force(
        clone,
        phlgitu_ref.make_remote(review_branch.branch, remote),
        phlgitu_ref.make_local(working_branch_name),
        remote)

    return working_branch
    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 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)
 def _add_abandoned_branches(
         self, abandoned_list, branches, working_branches, lander):
     for b in working_branches:
         rb = abdt_naming.makeReviewBranchNameFromWorkingBranch(b)
         if rb not in branches:
             working_branch = abdt_gittypes.makeGitWorkingBranch(
                 b, self._remote)
             abandoned_list.append(
                 abdt_branch.Branch(
                     self, None, working_branch, lander, self._description))