当前位置: 首页>>代码示例>>Python>>正文


Python GitHub.issue_comments方法代码示例

本文整理汇总了Python中github.GitHub.issue_comments方法的典型用法代码示例。如果您正苦于以下问题:Python GitHub.issue_comments方法的具体用法?Python GitHub.issue_comments怎么用?Python GitHub.issue_comments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.GitHub的用法示例。


在下文中一共展示了GitHub.issue_comments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1:

# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import issue_comments [as 别名]
            # Update the existing ticket with all the remaining info
            issue = ticket.get_github_data(milestone_id, labels)
            github.issues(id_=gid, data=issue)
        logging.info("Ticket mapping: trac=%d, gh=%d" % (ticket.tid, gid))
    
    # Skip comments while debugging
    if True:
        # Add comments
        comments = trac.sql('SELECT author, time, newvalue FROM ticket_change WHERE field="comment" AND ticket=%s' % ticket.tid)
        for author, time_t, body in comments:
            body = body.strip()
            if body:
                text = wiki.convert_author(author, "comment by")
                text += wiki.convert_time(time_t)
                text += wiki.convert(body)
                if text:
                    # prefix comment with author as git doesn't keep them separate
                    logging.debug('issue comment: %s' % text[:50]) # TODO: escape newlines
                    github.issue_comments(gid, data={'body': text})

    # Close tickets if they need it.
    # The v3 API says we should use PATCH, but
    # http://developer.github.com/v3/ says POST is supported.
    if ticket.status == 'closed':
        github.issues(id_=gid, data={'state': 'closed'})
        logging.debug("close")

trac.close()


开发者ID:robmcmullen,项目名称:github-migrate-trac-tickets,代码行数:30,代码来源:trac-tickets-to-gh.py

示例2:

# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import issue_comments [as 别名]
    	    type = 'bug'
    	github.addlabel(type, labels, issue, logging)
    if priority:
      github.addlabel(priority, labels, issue, logging)

    # We have to create/map Trac users to GitHub usernames before we can assign
    # them to tickets; don't see how to do that conveniently now.
    # if owner.strip():
    #     ticket['assignee'] = owner.strip()
    gh_issue = github.issues(data=issue)
    # Add comments
    comments = trac.sql('SELECT author, newvalue AS body FROM ticket_change WHERE field="comment" AND ticket=%s' % tid)
    for author, body in comments:
        body = body.strip()
        if body:
            # prefix comment with author as git doesn't keep them separate
            if author:
                body = "[%s] %s" % (author, body)
            logging.debug('issue comment: %s' % body[:40]) # TODO: escape newlines
            github.issue_comments(gh_issue['number'], data={'body': body})
    # Close tickets if they need it.
    # The v3 API says we should use PATCH, but
    # http://developer.github.com/v3/ says POST is supported.
    if status == 'closed':
        github.issues(id_=gh_issue['number'], data={'state': 'closed'})
        logging.debug("close")

trac.close()


开发者ID:callumski,项目名称:github-migrate-trac-tickets,代码行数:30,代码来源:trac-tickets-to-gh.py

示例3:

# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import issue_comments [as 别名]
        description += " * Reported at: **%s**\n" % datetime.datetime.fromtimestamp(timestamp).ctime()
        description += " * URL: %s/ticket/%d" % (trac_url, tid)
        issue["body"] = description
    if milestone and options.milestones:
        m = milestone_id.get(milestone)
        if m:
            issue["milestone"] = m
    # We have to create/map Trac users to GitHub usernames before we can assign
    # them to tickets; don't see how to do that conveniently now.
    # if owner.strip():
    #     ticket['assignee'] = owner.strip()
    gh_issue = github.issues(data=issue)
    # Add comments
    comments = trac.sql('SELECT author, newvalue AS body FROM ticket_change WHERE field="comment" AND ticket=%s' % tid)
    for author, body in comments:
        body = body.strip()
        if body:
            # prefix comment with author as git doesn't keep them separate
            if author:
                body = "[%s] %s" % (author, body)
            logging.debug("issue comment: %s" % body[:40])  # TODO: escape newlines
            github.issue_comments(gh_issue["number"], data={"body": body})
    # Close tickets if they need it.
    # The v3 API says we should use PATCH, but
    # http://developer.github.com/v3/ says POST is supported.
    if status == "closed":
        github.issues(id_=gh_issue["number"], data={"state": "closed"})
        logging.debug("close")

trac.close()
开发者ID:tfoote,项目名称:github-migrate-trac-tickets,代码行数:32,代码来源:migrate.py


注:本文中的github.GitHub.issue_comments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。