def createDifferentialReview(
        conduit, user, parsed, gitContext, review_branch, rawDiff):
    clone = gitContext.clone
    phlgit_checkout.new_branch_force_based_on(
        clone, review_branch.branch, review_branch.remote_branch)

    with phlsys_conduit.act_as_user_context(conduit, user):
        print "- creating diff"
        diffid = phlcon_differential.create_raw_diff(conduit, rawDiff).id

        print "- creating revision"
        review = phlcon_differential.create_revision(
            conduit, diffid, parsed.fields)
        print "- created " + str(review.revisionid)

        workingBranch = abdt_naming.makeWorkingBranchName(
            abdt_naming.WB_STATUS_OK,
            review_branch.description,
            review_branch.base,
            review.revisionid)

        print "- pushing working branch: " + workingBranch
        phlgit_push.push_asymmetrical(
            clone, review_branch.branch, workingBranch, gitContext.remote)

    print "- commenting on " + str(review.revisionid)
    commenter = abdcmnt_commenter.Commenter(conduit, review.revisionid)
    commenter.createdReview(review_branch.branch, review_branch.base)

    return review.revisionid
示例#2
0
    def test_A_Breathing(self):
        remote = "origin"

        expected_branches = [
            'r/master/blah',
            'r/master/blah2',
            'r/master/blah3',
        ]

        for branch in expected_branches:
            phlgit_push.push_asymmetrical(
                self.repo_dev, 'master', branch, remote)

        self.repo_arcyd("fetch")

        branches = abdt_git.get_managed_branches(
            self.repo_arcyd, "repo", abdt_rbranchnaming.Naming())

        actual_branches = [b.review_branch_name() for b in branches]

        self.assertSetEqual(set(expected_branches), set(actual_branches))

        for b in branches:

            self.repo_arcyd.archive_to_abandoned(
                b.review_branch_hash(),
                b.review_branch_name(),
                'master')

            self.repo_arcyd.archive_to_landed(
                b.review_branch_hash(),
                b.review_branch_name(),
                'master',
                'LANDHASH',
                'MESSAGE')
示例#3
0
    def test_A_Breathing(self):
        remote = "origin"

        expected_branches = [
            'r/master/blah',
            'r/master/blah2',
            'r/master/blah3',
        ]

        for branch in expected_branches:
            phlgit_push.push_asymmetrical(self.repo_dev, 'master', branch,
                                          remote)

        self.repo_arcyd("fetch")

        branches = abdt_git.get_managed_branches(self.repo_arcyd, "repo",
                                                 abdt_rbranchnaming.Naming())

        actual_branches = [b.review_branch_name() for b in branches]

        self.assertSetEqual(set(expected_branches), set(actual_branches))

        for b in branches:

            self.repo_arcyd.archive_to_abandoned(b.review_branch_hash(),
                                                 b.review_branch_name(),
                                                 'master')

            self.repo_arcyd.archive_to_landed(b.review_branch_hash(),
                                              b.review_branch_name(), 'master',
                                              'LANDHASH', 'MESSAGE')
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(
        clone,
        phlgitu_ref.make_remote(review_branch.branch, remote),
        phlgitu_ref.make_local(working_branch_name),
        remote)

    return working_branch
    def push_asymmetrical(self, local_branch, remote_branch):
        """Push 'local_branch' as 'remote_branch' to the remote.

        :local_branch: string name of the branch to push
        :remote_branch: string name of the branch on the remote
        :returns: None

        """
        phlgit_push.push_asymmetrical(
            self._clone, local_branch, remote_branch, self._remote)
def pushBadPreReview(gitContext, review_branch):
    working_branch_name = abdt_naming.makeWorkingBranchName(
        abdt_naming.WB_STATUS_BAD_PREREVIEW,
        review_branch.description, review_branch.base, "none")
    phlgit_push.push_asymmetrical(
        gitContext.clone,
        phlgitu_ref.make_remote(
            review_branch.branch, gitContext.remote),
        phlgitu_ref.make_local(working_branch_name),
        gitContext.remote)
示例#7
0
    def push_asymmetrical(self, local_branch, remote_branch):
        """Push 'local_branch' as 'remote_branch' to the remote.

        :local_branch: string name of the branch to push
        :remote_branch: string name of the branch on the remote
        :returns: None

        """
        phlgit_push.push_asymmetrical(self, local_branch, remote_branch,
                                      self._remote)