本文整理汇总了Python中vilya.models.pull.PullRequest.get_by_ticket方法的典型用法代码示例。如果您正苦于以下问题:Python PullRequest.get_by_ticket方法的具体用法?Python PullRequest.get_by_ticket怎么用?Python PullRequest.get_by_ticket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vilya.models.pull.PullRequest
的用法示例。
在下文中一共展示了PullRequest.get_by_ticket方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _index
# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_ticket [as 别名]
def _index(self, request):
user = self.user
yours = user.get_user_submit_pull_requests()
participated = user.get_participated_pull_requests()
invited = user.get_invited_pull_requests()
yours_list = [PullRequest.get_by_ticket(ticket).as_dict()
for ticket in yours]
participated_list = [PullRequest.get_by_ticket(ticket).as_dict()
for ticket in participated]
invited_list = [PullRequest.get_by_ticket(ticket).as_dict()
for ticket in invited]
yours_list = filter(lambda t: t, yours_list)
participated = filter(lambda t: t, participated)
invited_list = filter(lambda t: t, invited_list)
rs = []
if yours_list:
rs.append({'section': 'Yours', 'pulls': yours_list})
if participated_list:
rs.append({'section': 'Participated', 'pulls': participated_list})
if invited_list:
rs.append({'section': 'Invited', 'pulls': invited_list})
return rs
示例2: main
# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_ticket [as 别名]
def main():
rs = store.execute("select id "
"from codedouban_ticket")
for r in rs:
id, = r
ticket = Ticket.get(id)
# update merge
pullreq = PullRequest.get_by_ticket(ticket)
author = pullreq.merge_by or pullreq.to_proj.owner_id
time = pullreq.merge_time
ticket_id = ticket.id
id = 0
if not get_node(author, TICKET_NODE_TYPE_MERGE, id, ticket_id, time) and time:
print id, author, time, ticket_id
store.execute("insert into ticket_nodes "
"(author, type, type_id, ticket_id, created_at) "
"value (%s, %s, %s, %s, %s)",
(author, TICKET_NODE_TYPE_MERGE, id, ticket_id, time))
store.commit()
# update close
author = ticket.close_by or ticket.author
time = ticket.closed
ticket_id = ticket.id
id = 0
if not get_node(author, TICKET_NODE_TYPE_CLOSE, id, ticket_id, time) and time:
print id, author, time, ticket_id
store.execute("insert into ticket_nodes "
"(author, type, type_id, ticket_id, created_at) "
"value (%s, %s, %s, %s, %s)",
(author, TICKET_NODE_TYPE_CLOSE, id, ticket_id, time))
store.commit()
print "update %s close & merge pulls" % len(rs)
示例3: add_code_review_action
# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_ticket [as 别名]
def add_code_review_action(sender, **kw):
data = format_code_review_info(sender, **kw)
ticket = kw['ticket']
author = kw['author']
pullreq = PullRequest.get_by_ticket(ticket)
feeds = get_related_feeds(author, pullreq.to_proj)
for feed in feeds:
feed.add_action(data)
示例4: __init__
# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_ticket [as 别名]
def __init__(self, data):
NotificationDispatcher.__init__(self, data)
self._sender = data.get('sender')
self._comment = data.get('comment')
self._content = self._comment.content if self._comment else data.get('content', '')
self._ticket = data.get('ticket')
self._pullreq = PullRequest.get_by_ticket(self._ticket)
self._target = self._pullreq.to_proj
self._is_ticketcomment = isinstance(self._comment, TicketComment)
示例5: _latest_update_branch
# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_ticket [as 别名]
def _latest_update_branch(project, ref, user):
if user:
get_pr = user.get_user_submit_pull_requests
latest_tickets = get_pr(limit=5, is_closed=False) + get_pr(limit=5, is_closed=True)
latest_tickets = filter(None, [PullRequest.get_by_ticket(t) for t in latest_tickets if t.project])
has_pr_branches = [t.from_ref for t in latest_tickets]
else:
has_pr_branches = []
latest_update_branches = filter(
lambda b: b[1] != ref and b[1] not in has_pr_branches, project.repo.get_latest_update_branches()
)
latest_update_branch = latest_update_branches[0][1] if latest_update_branches else ""
return latest_update_branch
示例6: add_code_review
# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_ticket [as 别名]
def add_code_review(self, ticket, author, text, commit_id):
ticket_fields = ticket.values
from vilya.models.pull import PullRequest
pullreq = PullRequest.get_by_ticket(ticket)
uid = 'codereview-%s-%s-%s' % (pullreq.to_proj, ticket.id, commit_id)
data = dict(
date=datetime.now(),
url="/%s/pull/%s" % (pullreq.to_proj, ticket.id),
ticket=ticket.id,
proj="%s:%s" % (pullreq.to_proj, pullreq.to_branch),
receiver=ticket_fields['reporter'],
author=author,
text=text,
uid=uid,
)
self.add_code_review_data(data)