本文整理汇总了Python中github.GitHub.milestones方法的典型用法代码示例。如果您正苦于以下问题:Python GitHub.milestones方法的具体用法?Python GitHub.milestones怎么用?Python GitHub.milestones使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.GitHub
的用法示例。
在下文中一共展示了GitHub.milestones方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import milestones [as 别名]
# Get GitHub labels; we'll merge Trac components and other values into them
logging.info("Getting existing GitHub labels...")
labels = {}
for label in github.labels():
labels[label['name']] = label['url'] # ignoring 'color'
logging.debug("label name=%s" % label['name'])
# Get any existing GitHub milestones so we can merge Trac into them.
# We need to reference them by numeric ID in tickets.
# API returns only 'open' issues by default, have to ask for closed like:
# curl -u 'USER:PASS' https://api.github.com/repos/USERNAME/REPONAME/milestones?state=closed
logging.info("Getting existing GitHub milestones...")
milestone_id = {}
for m in github.milestones():
milestone_id[m['title']] = m['number']
logging.debug("milestone (open) title=%s" % m['title'])
for m in github.milestones(query='state=closed'):
milestone_id[m['title']] = m['number']
logging.debug("milestone (closed) title=%s" % m['title'])
# We have no way to set the milestone closed date in GH.
# The 'due' and 'completed' are long ints representing datetimes.
logging.info("Migrating Trac milestones to GitHub...")
milestones = trac.sql('SELECT name, description, due, completed FROM milestone')
for name, description, due, completed in milestones:
name = name.strip()
logging.debug("milestone name=%s due=%s completed=%s" % (name, due, completed))
if name and name not in milestone_id: