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


Python PullRequest.get_by_proj_and_ticket方法代码示例

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


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

示例1: __init__

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
 def __init__(self, ticket):
     self.project = CodeDoubanProject.get(ticket.project_id)
     self.proj_name = self.project.name
     self.ticket_id = ticket.ticket_number
     self.ticket = ticket
     self.pullreq = PullRequest.get_by_proj_and_ticket(
         self.project.id, self.ticket_id)
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:pull.py

示例2: get

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
    def get(self, request):
        _date_from = None
        _date_to = None
        state = request.get_form_var('state', '')
        author = request.get_form_var('author', '')
        date_from = request.get_form_var('from', '')
        date_to = request.get_form_var('to', '')
        if not state or state == "open":
            closed = False
        else:
            closed = True
        if date_from:
            _date_from = date_from
        if date_to:
            _date_to = date_to

        tickets = Ticket.gets(project_id=self.repo.id,
                              author=author,
                              date_from=_date_from,
                              date_to=_date_to,
                              closed=closed)
        pulls = []
        for t in tickets:
            pull = PullRequest.get_by_proj_and_ticket(self.repo.id,
                                                      t.ticket_number)
            pulls.append(pull.as_dict())
        return pulls
开发者ID:000fan000,项目名称:code,代码行数:29,代码来源:pulls.py

示例3: open_pulls

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
 def open_pulls(self):
     from vilya.models.ticket import Ticket
     from vilya.models.pull import PullRequest
     pulls = [PullRequest.get_by_proj_and_ticket(self.id,
                                                 t.ticket_id)
              for t in Ticket.gets_by_proj(self.id,
                                           limit=9999)]
     return pulls
开发者ID:000fan000,项目名称:code,代码行数:10,代码来源:project.py

示例4: index_a_project_pr

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
 def index_a_project_pr(cls, project):
     rs = store.execute("select ticket_id from pullreq "
                        "where to_project=%s", project.id)
     for r, in rs:
         pr = PullRequest.get_by_proj_and_ticket(project.id, r)
         if pr:
             data = pr.as_dict()
             if data:
                 serial = "%s_%s" % (project.index_name, r)
                 cls.index_an_object(serial, data)
开发者ID:000fan000,项目名称:code,代码行数:12,代码来源:issue_pr_search.py

示例5: commits

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
    def commits(self, request):
        if not self.ticket:
            raise TraversalError()

        pr = PullRequest.get_by_proj_and_ticket(
            self.project.id, self.ticket.ticket_number)
        commits = pr.get_commits_shas()
        commits = [TicketCommits.commit_as_dict(self.project, c)
                   for c in commits]
        # commits = reduce(lambda x, y: x + y, commits)
        return commits
开发者ID:000fan000,项目名称:code,代码行数:13,代码来源:pulls.py

示例6: _index

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
    def _index(self, request):
        project = CodeDoubanProject.get_by_name(self.proj_name)
        open_tickets = Ticket.gets_by_proj(project.id, limit=9999)

        pr_list = []
        for t in open_tickets:
            pullreq = PullRequest.get_by_proj_and_ticket(project.id,
                                                         t.ticket_number)
            if pullreq:
                pr_list.append(pullreq.as_dict())
        return pr_list
开发者ID:000fan000,项目名称:code,代码行数:13,代码来源:pulls.py

示例7: __init__

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
    def __init__(self, project_id, ticket_id):
        self.project_id = project_id
        self.ticket_id = ticket_id

        self.ticket = Ticket.get_by_projectid_and_ticketnumber(self.project_id,
                                                               self.ticket_id)

        if not self.ticket:
            raise NotFoundError('pull')

        self.pullreq = PullRequest.get_by_proj_and_ticket(
            self.project_id, self.ticket.ticket_number)
开发者ID:000fan000,项目名称:code,代码行数:14,代码来源:pulls.py

示例8: open_network_pulls

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
 def open_network_pulls(self):
     from vilya.models.ticket import Ticket
     from vilya.models.pull import PullRequest
     pulls = []
     projects = self.get_fork_network()
     for project in projects:
         ps = [PullRequest.get_by_proj_and_ticket(project.id,
                                                  t.ticket_id)
               for t in Ticket.gets_by_proj(project.id,
                                            limit=9999)]
         pulls.extend([p for p in ps
                       if p and p.from_proj and p.from_proj.id == self.id])
     return pulls + self.open_pulls
开发者ID:000fan000,项目名称:code,代码行数:15,代码来源:project.py

示例9: open_parent_pulls

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
 def open_parent_pulls(self):
     from vilya.models.ticket import Ticket
     from vilya.models.pull import PullRequest
     pulls = []
     parent = self.get_forked_from()
     if parent:
         pulls = [PullRequest.get_by_proj_and_ticket(parent.id,
                                                     t.ticket_id)
                  for t in Ticket.gets_by_proj(parent.id,
                                               limit=9999)]
         pulls = [p for p in pulls
                  if p and p.from_proj and p.from_proj.id == self.id]
     return pulls
开发者ID:000fan000,项目名称:code,代码行数:15,代码来源:project.py

示例10: gen_telchar_data

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
def gen_telchar_data(data):
    ticket_id = data.get('ticket_id')
    ticket = Ticket.get(ticket_id)
    pullreq = PullRequest.get_by_proj_and_ticket(
        ticket.project.id, ticket.ticket_id)
    fork_from = pullreq.from_proj.fork_from
    fork_from = pullreq.from_proj.get(fork_from).url if fork_from else None
    return {
        'ticket_id': ticket.ticket_id,
        'fork_from': fork_from,
        'url': pullreq.from_proj.url,
        'to_sha': pullreq.to_sha,
        'from_sha': pullreq.from_sha
    }
开发者ID:000fan000,项目名称:code,代码行数:16,代码来源:pr_actions.py

示例11: close

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
 def close(self, request):
     user = request.user
     if user:
         ticket = self.ticket
         pullreq = PullRequest.get_by_proj_and_ticket(
             self.project.id,
             self.ticket.ticket_number)
         comment = ticket.add_comment('close pr', user.name)
         error = close_pull(self.ticket, pullreq, user, 'close pr',
                            comment, request)
         if error:
             raise NoPushPermissionError(error)
         return {'ok': True}
     raise UnauthorizedError
开发者ID:000fan000,项目名称:code,代码行数:16,代码来源:pulls.py

示例12: merge

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
 def merge(self, request):
     user = request.user
     if user:
         pullreq = PullRequest.get_by_proj_and_ticket(
             self.project.id,
             self.ticket.ticket_number)
         if pullreq.merged:
             return {'ok': True}
         error = merge_pull(self.ticket, pullreq, user, '', request)
         if error:
             raise NoPushPermissionError(error)
         else:
             return {'ok': True}
     raise UnauthorizedError
开发者ID:000fan000,项目名称:code,代码行数:16,代码来源:pulls.py

示例13: _get_pr_by_project_and_ticket

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
def _get_pr_by_project_and_ticket(project, ticket):
    pull = PullRequest.get_by_proj_and_ticket(project.id, ticket.ticket_id)
    _from_project = _get_project_by_name(str(pull.from_proj))
    if _from_project:
        _from_project['branch'] = pull.from_branch
    _to_project = _get_project_by_name(str(pull.to_proj))
    if _to_project:
        _to_project['branch'] = pull.to_branch
    commits = pull.commits
    commit = [_format_commit_object_data(c) for c in commits]
    pr = dict(
        id=ticket.ticket_id,
        name=ticket.title,
        from_project=_from_project,
        to_project=_to_project,
        commit=commit,
    )
    return pr
开发者ID:000fan000,项目名称:code,代码行数:20,代码来源:timeline.py

示例14: _toggle_whitespace

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
    def _toggle_whitespace(self, request, project, paths, ignore_space,
                           **kwargs):
        # For pull/new
        from_proj = request.get_form_var('from_proj')
        from_ref = request.get_form_var('from_ref')
        to_ref = request.get_form_var('to_ref')
        to_proj = request.get_form_var('to_proj')

        sha1 = kwargs.get('sha1')
        context_lines = kwargs.get('context_lines')
        ref = sha1
        if ref is None:
            ref = project.default_branch
        if hasattr(self, 'ticket'):
            pullreq = PullRequest.get_by_proj_and_ticket(
                project.id, self.ticket.ticket_number)
            linecomments = PullLineComment.gets_by_target(self.ticket.id)
        else:
            from_proj = CodeDoubanProject.get_by_name(from_proj)
            parent_proj = from_proj.get_forked_from()
            if to_proj:
                to_proj = CodeDoubanProject.get_by_name(to_proj)
            elif parent_proj:
                to_proj = parent_proj
            else:
                to_proj = from_proj
            pullreq = PullRequest.open(from_proj, from_ref, to_proj, to_ref)
            linecomments = []

        kw = {
            'paths': paths,
            'rename_detection': True,
            'linecomments': linecomments
        }
        if context_lines is not None:
            kw.update({'context_lines': context_lines})
        diff = pullreq.get_diff(**kw)
        return diff
开发者ID:000fan000,项目名称:code,代码行数:40,代码来源:diff.py

示例15: _q_lookup

# 需要导入模块: from vilya.models.pull import PullRequest [as 别名]
# 或者: from vilya.models.pull.PullRequest import get_by_proj_and_ticket [as 别名]
    def _q_lookup(self, request, pullid):
        if request.get_path().find('newpull') > 0:
            return request.redirect(request.get_path().replace(
                'newpull', 'pull'))
        if pullid.count('.') == 1:
            pullid, diff_type = pullid.split('.')
            pr = PullRequest.get_by_proj_and_ticket(self.project.id, pullid)
            resp = request.response
            resp.set_header("Content-Type", "text/plain")
            if diff_type == 'patch' and pr:
                text = pr.get_format_patch()
                return text.encode('utf-8')
            elif diff_type == 'diff' and pr:
                text = pr.get_diff_tree()
                return text
            else:
                raise TraversalError

        if pullid.isdigit():
            ticket = Ticket.get_by_projectid_and_ticketnumber(
                self.project.id, pullid)
            if ticket:
                return TicketUI(self.proj_name, pullid)
        raise TraversalError
开发者ID:000fan000,项目名称:code,代码行数:26,代码来源:pull.py


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