Exemplo n.º 1
0
    def renderPinUpdateLink(self, branch, reference_name, repoRef):
        if repoRef.auto and repoRef.auto != "false":
            return HtmlGeneration.lightGrey("marked auto")
        else:
            commit = branch.head

            targetRepoName = "/".join(repoRef.reference.split("/")[:-1])

            target_branch = self.testManager.database.Branch.lookupAny(
                reponame_and_branchname=(targetRepoName, repoRef.branch))

            if not target_branch:
                return HtmlGeneration.lightGrey("unknown branch %s" %
                                                repoRef.branch)

            if target_branch.head.hash == repoRef.reference.split("/")[-1]:
                return HtmlGeneration.lightGrey("up to date")

            message = "push commit updating pin of %s from %s to %s" % (
                reference_name, target_branch.head.hash,
                repoRef.reference.split("/")[-1])

            params = {
                "redirect": self.redirect(),
                "repoName": commit.repo.name,
                "branchName": branch.branchname,
                "ref": reference_name
            }

            return ('<a href="/updateBranchPin?' + urllib.urlencode(params) +
                    '" title="' + message + '">'
                    '<span class="octicon octicon-sync " aria-hidden="true" />'
                    '</a>')
Exemplo n.º 2
0
    def getBranchCommitRow(self, commit, renderer):
        row = [self.getContextForCommit(commit).renderLinkWithShaHash()]

        all_tests = self.testManager.allTestsForCommit(commit)

        if all_tests:
            row[-1] += "&nbsp;" + self.contextFor(
                commit).toggleCommitUnderTestLink()

        row.extend(renderer.gridRow(commit))

        if False:
            row.append(
                HtmlGeneration.lightGrey("waiting to load commit") if
                not commit.data else HtmlGeneration.lightGrey("no test file")
                if commit.data.noTestsFound else HtmlGeneration.
                lightGrey("invalid test file"
                          ) if commit.data.testDefinitionsError else "")

        row.append(self.contextFor(commit).renderSubjectAndAuthor())

        return row
Exemplo n.º 3
0
 def sourceLinkForCommit(self, commit):
     url = self.src_ctrl.commit_url(commit.repo.name, commit.hash)
     if url:
         return HtmlGeneration.link(commit.hash[:7], url)
     else:
         return HtmlGeneration.lightGrey(commit.hash[:7])