def usedDefaultTestPlan(self, test_plan):
     message = "a test plan could not be determined from the commits on "
     message += "the review branch, so the following message was used:\n"
     message += phlcon_remarkup.code_block(test_plan, lang="text")
     message += "for a test plan to be recognised, please use text like "
     message += "the following in your latest commit message: \n"
     message += phlcon_remarkup.code_block("Test Plan:\nmy test plan",
                                           lang="text")
     message += "as author you may edit the test plan directly by "
     message += "using the 'edit revision' link at the top-right of "
     message += "this review page."
     self._createComment(message, silent=True)
 def usedDefaultTestPlan(self, test_plan):
     message = "a test plan could not be determined from the commits on "
     message += "the review branch, so the following message was used:\n"
     message += phlcon_remarkup.code_block(test_plan, lang="text")
     message += "for a test plan to be recognised, please use text like "
     message += "the following in your latest commit message: \n"
     message += phlcon_remarkup.code_block(
         "Test Plan:\nmy test plan", lang="text")
     message += "as author you may edit the test plan directly by "
     message += "using the 'edit revision' link at the top-right of "
     message += "this review page."
     self._createComment(message, silent=True)
    def _landingPushBaseException(self, e):
        base = phlcon_remarkup.monospaced(e.base_name)
        branch = phlcon_remarkup.monospaced(e.review_branch_name)
        author = phlcon_remarkup.bold('author')
        errors = phlcon_remarkup.code_block(str(e), lang="text", isBad=True)
        reviewer = phlcon_remarkup.bold('reviewer')

        message = (
            "failed to push landed revision to {base}, see below.\n"
            "\n"
            "errors:\n"
            "{errors}"
            "this might be down to permissioning or maybe someone else "
            "updated the branch before we pushed.\n"
            "\n"
            "if there's a permissioning error then please ask the admin of "
            "this repository to resolve it before proceeding.\n"
            "\n"
            "{reviewer} may accept review again to retry the landing.\n"
        ).format(
            base=base,
            branch=branch,
            author=author,
            errors=errors,
            reviewer=reviewer)

        self._createComment(message)
    def _missingBaseException(self, e):
        field_table = phlcon_remarkup.dict_to_table({
            'description': e.description,
            'base': e.base_name
        })
        remove_instructions = phlcon_remarkup.code_block(
            "git push origin :{branch}".format(branch=e.review_branch_name),
            lang="shell")
        message = (
            "the specified base branch does not exist: {base}\n"
            "\n"
            "the 'base' is the branch to diff against and to land on when "
            "the review is approved.\n"
            "\n"
            "here's how the branch name {branch} was interpreted:\n"
            "{field_table}\n"
            "as author you should clean up like so:\n"
            "\n"
            "- abandon this review using the 'comment' drop down at the "
            "bottom of this page.\n"
            "- remove the associated review branch like so:\n"
            "{remove_instructions}\n"
            "in the future please ensure that the base branch exists "
            "before creating a review to land on it.").format(
                base=phlcon_remarkup.monospaced(e.base_name),
                branch=phlcon_remarkup.monospaced(e.review_branch_name),
                field_table=field_table,
                remove_instructions=remove_instructions)

        self._createComment(message)
    def _missingBaseException(self, e):
        field_table = phlcon_remarkup.dict_to_table({
            'description': e.description,
            'base': e.base_name})
        remove_instructions = phlcon_remarkup.code_block(
            "git push origin :{branch}".format(branch=e.review_branch_name),
            lang="shell")
        message = (
            "the specified base branch does not exist: {base}\n"
            "\n"
            "the 'base' is the branch to diff against and to land on when "
            "the review is approved.\n"
            "\n"
            "here's how the branch name {branch} was interpreted:\n"
            "{field_table}\n"
            "as author you should clean up like so:\n"
            "\n"
            "- abandon this review using the 'comment' drop down at the "
            "bottom of this page.\n"
            "- remove the associated review branch like so:\n"
            "{remove_instructions}\n"
            "in the future please ensure that the base branch exists "
            "before creating a review to land on it."
        ).format(
            base=phlcon_remarkup.monospaced(e.base_name),
            branch=phlcon_remarkup.monospaced(e.review_branch_name),
            field_table=field_table,
            remove_instructions=remove_instructions)

        self._createComment(message)
    def _landingPushBaseException(self, e):
        base = phlcon_remarkup.monospaced(e.base_name)
        branch = phlcon_remarkup.monospaced(e.review_branch_name)
        author = phlcon_remarkup.bold('author')
        errors = phlcon_remarkup.code_block(str(e), lang="text", isBad=True)
        reviewer = phlcon_remarkup.bold('reviewer')

        message = (
            "failed to push landed revision to {base}, see below.\n"
            "\n"
            "errors:\n"
            "{errors}"
            "this might be down to permissioning or maybe someone else "
            "updated the branch before we pushed.\n"
            "\n"
            "if there's a permissioning error then please ask the admin of "
            "this repository to resolve it before proceeding.\n"
            "\n"
            "{reviewer} may accept review again to retry the landing.\n"
        ).format(base=base,
                 branch=branch,
                 author=author,
                 errors=errors,
                 reviewer=reviewer)

        self._createComment(message)
    def _landingException(self, e):
        base = phlcon_remarkup.monospaced(e.base_name)
        branch = phlcon_remarkup.monospaced(e.review_branch_name)
        author = phlcon_remarkup.bold('author')
        errors = phlcon_remarkup.code_block(str(e), lang="text", isBad=True)
        reviewer = phlcon_remarkup.bold('reviewer')

        message = ("failed to land revision on {base}, see below.\n"
                   "\n"
                   "errors:\n"
                   "{errors}"
                   "this is probably due to merge conflicts.\n"
                   "\n"
                   "{author}, please do the following:\n"
                   "\n"
                   "- merge {base} into {branch}\n"
                   "- resolve merge conflicts\n"
                   "- push to {branch}\n"
                   "\n"
                   "{reviewer} may then accept review with the new changes.\n"
                   ).format(base=base,
                            branch=branch,
                            author=author,
                            errors=errors,
                            reviewer=reviewer)

        self._createComment(message)
    def _commitMessageParseException(self, e):
        message = "errors were encountered, see below.\n"
        message += "\n"

        message += "errors:\n"
        for error in e.errors:
            message += phlcon_remarkup.code_block(
                str(error), lang="text", isBad=True)

        message += "fields:\n"
        message += phlcon_remarkup.dict_to_table(e.fields)

        message += "combined commit message digest:\n"
        message += phlcon_remarkup.code_block(e.digest, lang="text")

        self._createComment(message)
    def _landingException(self, e):
        base = phlcon_remarkup.monospaced(e.base_name)
        branch = phlcon_remarkup.monospaced(e.review_branch_name)
        author = phlcon_remarkup.bold('author')
        errors = phlcon_remarkup.code_block(str(e), lang="text", isBad=True)
        reviewer = phlcon_remarkup.bold('reviewer')

        message = (
            "failed to land revision on {base}, see below.\n"
            "\n"
            "errors:\n"
            "{errors}"
            "this is probably due to merge conflicts.\n"
            "\n"
            "{author}, please do the following:\n"
            "\n"
            "- merge {base} into {branch}\n"
            "- resolve merge conflicts\n"
            "- push to {branch}\n"
            "\n"
            "{reviewer} may then accept review with the new changes.\n"
        ).format(
            base=base,
            branch=branch,
            author=author,
            errors=errors,
            reviewer=reviewer)

        self._createComment(message)
Ejemplo n.º 10
0
    def _userException(self, e):
        message = "errors were encountered, see below.\n"
        message += "\n"

        message += "errors:\n"
        message += phlcon_remarkup.code_block(str(e), lang="text", isBad=True)

        self._createComment(message)
Ejemplo n.º 11
0
    def _commitMessageParseException(self, e):
        message = "errors were encountered, see below.\n"
        message += "\n"

        message += "errors:\n"
        for error in e.errors:
            message += phlcon_remarkup.code_block(str(error),
                                                  lang="text",
                                                  isBad=True)

        message += "fields:\n"
        message += phlcon_remarkup.dict_to_table(e.fields)

        message += "combined commit message digest:\n"
        message += phlcon_remarkup.code_block(e.digest, lang="text")

        self._createComment(message)
    def _userException(self, e):
        message = "errors were encountered, see below.\n"
        message += "\n"

        message += "errors:\n"
        message += phlcon_remarkup.code_block(str(e), lang="text", isBad=True)

        self._createComment(message)
 def landedReview(self, branch_name, base_name, git_output):
     message = "landed "
     message += phlcon_remarkup.monospaced(branch_name) + " "
     message += " on "
     message += phlcon_remarkup.monospaced(base_name) + "\n"
     message += "deleted " + phlcon_remarkup.monospaced(branch_name) + "\n"
     message += "git output:\n"
     message += phlcon_remarkup.code_block(git_output, lang="text")
     self._createComment(message, silent=True)
Ejemplo n.º 14
0
    def unknownReviewers(self, unknown_reviewers, commit_message):
        unknown_users_markup = phlcon_remarkup.code_block(
            ', '.join(unknown_reviewers), lang="text", isBad=True)

        commit_message_markup = phlcon_remarkup.code_block(commit_message,
                                                           lang="text",
                                                           isBad=True)

        message = (
            "some reviewers specified in the commit message are unknown\n"
            "{unknown_users_block}"
            "please carefully review the current list of reviewers to make "
            "sure there are no other errors.\n"
            "\n"
            "commit message from branch:\n"
            "{commit_message}").format(
                unknown_users_block=unknown_users_markup,
                commit_message=commit_message_markup)

        self._createComment(message)
    def _diffException(self, e):
        message = str("failed to create diff, tried to reduce context but it "
                      "was still too large.\n")
        message += "\n"
        message += "diff size: " + str(e.diff_len) + " bytes\n"
        message += "diff size limit: " + str(e.diff_len_limit) + " bytes\n"
        message += "summary:\n"
        message += phlcon_remarkup.code_block(
            str(e.diff_summary), lang="text", isBad=True)

        self._createComment(message)
Ejemplo n.º 16
0
 def landedReview(self, branch_hash, branch_name, base_name, git_output):
     message = "landed "
     message += phlcon_remarkup.monospaced(branch_name) + " "
     message += " on "
     message += phlcon_remarkup.monospaced(base_name) + "\n"
     message += "original commit "
     message += phlcon_remarkup.monospaced(branch_hash) + "\n"
     message += "deleted " + phlcon_remarkup.monospaced(branch_name) + "\n"
     message += "git output:\n"
     message += phlcon_remarkup.code_block(git_output, lang="text")
     self._createComment(message, silent=True)
Ejemplo n.º 17
0
    def _diffException(self, e):
        message = str("failed to create diff, tried to reduce context but it "
                      "was still too large.\n")
        message += "\n"
        message += "diff size: " + str(e.diff_len) + " bytes\n"
        message += "diff size limit: " + str(e.diff_len_limit) + " bytes\n"
        message += "summary:\n"
        message += phlcon_remarkup.code_block(str(e.diff_summary),
                                              lang="text",
                                              isBad=True)

        self._createComment(message)
    def unknownReviewers(self, unknown_reviewers, commit_message):
        unknown_users_markup = phlcon_remarkup.code_block(
            ', '.join(unknown_reviewers),
            lang="text",
            isBad=True)

        commit_message_markup = phlcon_remarkup.code_block(
            commit_message, lang="text", isBad=True)

        message = (
            "some reviewers specified in the commit message are unknown\n"
            "{unknown_users_block}"
            "please carefully review the current list of reviewers to make "
            "sure there are no other errors.\n"
            "\n"
            "commit message from branch:\n"
            "{commit_message}").format(
            unknown_users_block=unknown_users_markup,
            commit_message=commit_message_markup)

        self._createComment(message)
    def removedSelfReviewer(self, user, commit_message):
        commit_message_markup = phlcon_remarkup.code_block(
            commit_message, lang="text", isBad=True)

        message = (
            "{user}, you added yourself to the list of reviewers in your "
            "commit message.\n"
            "\n"
            "phabricator does not permit the author of a review to also be a "
            "reviewer.\n"
            "\n"
            "please carefully review the current list of reviewers to make "
            "sure there are no other errors.\n"
            "\n"
            "commit message from branch:\n"
            "{commit_message}").format(
            user=user, commit_message=commit_message_markup)

        self._createComment(message)
    def removedSelfReviewer(self, branch_name, digest):
        digest_markup = phlcon_remarkup.code_block(
            digest, lang="text", isBad=True)

        branch_markup = phlcon_remarkup.monospaced(branch_name)

        message = (
            "author, you added yourself to the list of reviewers in your "
            "commit message.\n"
            "\n"
            "phabricator does not permit the author of a review to also be a "
            "reviewer.\n"
            "\n"
            "please carefully review the current list of reviewers to make "
            "sure there are no other errors.\n"
            "\n"
            "combined message digest from branch {branch}:\n"
            "{digest}").format(branch=branch_markup, digest=digest_markup)

        self._createComment(message)
Ejemplo n.º 21
0
    def removedSelfReviewer(self, user, commit_message):
        commit_message_markup = phlcon_remarkup.code_block(commit_message,
                                                           lang="text",
                                                           isBad=True)

        message = (
            "{user}, you added yourself to the list of reviewers in your "
            "commit message.\n"
            "\n"
            "phabricator does not permit the author of a review to also be a "
            "reviewer.\n"
            "\n"
            "please carefully review the current list of reviewers to make "
            "sure there are no other errors.\n"
            "\n"
            "commit message from branch:\n"
            "{commit_message}").format(user=user,
                                       commit_message=commit_message_markup)

        self._createComment(message)
    def _landingException(self, e):
        base = phlcon_remarkup.monospaced(e.base_name)
        branch = phlcon_remarkup.monospaced(e.review_branch_name)
        author = phlcon_remarkup.bold('author')
        reviewer = phlcon_remarkup.bold('reviewer')

        message = "failed to land revision on " + base + ", see below.\n"
        message += "\n"
        message += "errors:\n"
        message += phlcon_remarkup.code_block(str(e), lang="text", isBad=True)
        message += "this is probably due to merge conflicts.\n"
        message += "\n"
        message += author + ", please do the following:\n"
        message += "\n"
        message += "- merge " + base + " into " + branch + "\n"
        message += "- resolve merge conflicts\n"
        message += "- push to " + branch + "\n"
        message += "\n"
        message += reviewer + " may then accept review with the new changes.\n"

        self._createComment(message)