sparkprs/jira_api.py
def link_issue_to_pr(issue, pr):
    """
    Create a link in JIRA to a pull request and add a comment linking to the PR.

    This method is idempotent; the links will only be created if they do not already exist.
    """
    jira_client = get_jira_client()
    url = pr.pr_json['html_url']
    title = "[Github] Pull Request #%s (%s)" % (pr.number, pr.user)

    existing_links = map(lambda l: l.raw['object']['url'], jira_client.remote_links(issue))
    if url in existing_links:
        return

    icon = {"title": "Pull request #%s" % pr.number,
            "url16x16": "https://assets-cdn.github.com/favicon.ico"}
    destination = {"title": title, "url": url, "icon": icon}
    jira_client.add_remote_link(issue, destination)

    comment = "User '%s' has created a pull request for this issue:\n%s" % (pr.user, url)
    jira_client.add_comment(issue, comment)
    logging.info("Linked PR %s to JIRA %s" % (pr.number, issue))

    Create a link in JIRA to a pull request and add a comment linking to the PR.

    This method is idempotent; the links will only be created if they do not already exist.
    
Create a link in JIRA to a pull request and add a comment linking to the PR.
This method is idempotent; the links will only be created if they do not already exist.
Create a link in JIRA to a pull request and add a comment linking to the PR . This method is idempotent ; the links will only be created if they do not already exist .
def link_issue_to_pr(issue, pr):
    jira_client = get_jira_client()
    url = pr.pr_json['html_url']
    title = "[Github] Pull Request #%s (%s)" % (pr.number, pr.user)
    existing_links = map(lambda l: l.raw['object']['url'], jira_client.remote_links(issue))
    if url in existing_links:
        return
    icon = {"title": "Pull request #%s" % pr.number,
            "url16x16": "https://assets-cdn.github.com/favicon.ico"}
    destination = {"title": title, "url": url, "icon": icon}
    jira_client.add_remote_link(issue, destination)
    comment = "User '%s' has created a pull request for this issue:\n%s" % (pr.user, url)
    jira_client.add_comment(issue, comment)
    logging.info("Linked PR %s to JIRA %s" % (pr.number, issue))
def link_issue_to_pr ( issue , pr ) : jira_client = get_jira_client ( ) url = pr . pr_json [ 'html_url' ] title = "[Github] Pull Request #%s (%s)" % ( pr . number , pr . user ) existing_links = map ( lambda l : l . raw [ 'object' ] [ 'url' ] , jira_client . remote_links ( issue ) ) if url in existing_links : return icon = { "title" : "Pull request #%s" % pr . number , "url16x16" : "https://assets-cdn.github.com/favicon.ico" } destination = { "title" : title , "url" : url , "icon" : icon } jira_client . add_remote_link ( issue , destination ) comment = "User '%s' has created a pull request for this issue:\n%s" % ( pr . user , url ) jira_client . add_comment ( issue , comment ) logging . info ( "Linked PR %s to JIRA %s" % ( pr . number , issue ) )
Create a link in JIRA to a pull request and add a comment linking to the PR.
Create a link in JIRA to a pull request and add a comment linking to the PR .
"""
    Create a link in JIRA to a pull request and add a comment linking to the PR.

    This method is idempotent; the links will only be created if they do not already exist.
    """
issue
pr