Pygithub: Nenhum comentário foi retornado para PullRequest

Criado em 21 ago. 2012  ·  7Comentários  ·  Fonte: PyGithub/PyGithub

Olá, aqui está o problema.
Nenhum comentário retornou. Mas os comentários contam mostrando o valor adequado.

p = z.pulls [1]
p
RESULTADO:
SAÍDA: u '\ u041d \ u0435 \ u043f \ u0440 \ u0438 \ u043d \ u0438 \ u043c \ u0430 \ u0442 \ u044c =)'
p.comments
SAÍDA: 1
p.get_comments ()
RESULTADO:
list (p.get_comments ())
RESULTADO: []

Alguma ideia ?

bug feature request

Todos 7 comentários

Olá!

Confirmo que o código a seguir apresenta o mesmo problema:

import github

g = github.Github()
r = g.get_user( "jacquev6" ).get_repo( "PyGithub" )
p = r.get_pull( 57 )
print p.title, "has", p.comments, "comments"
print [ c.body[ :15 ] for c in p.get_comments() ]

Ele imprime:

Allows connection to GitHub Enterprise installs on local URLs has 2 comments
[]

Esta última linha chama a API https://api.github.com/repos/jacquev6/PyGithub/pulls/57/comments , conforme documentado em http://developer.github.com/v3/pulls/comments/#list -comments -on-a-pull-request, mas a API retorna uma lista vazia. Acabei de obter os comentários ligando para https://api.github.com/repos/jacquev6/PyGithub/issues/57/comments . A questão deve estar do lado do Github.

Como solução temporária , você pode usar o código a seguir para fazer como se a solicitação pull fosse um problema e chamar a outra API:

print [ c.body[ :15 ] for c in r.get_issue( p.number ).get_comments() ]

No momento, não tenho tempo suficiente para cuidar desse problema, mas se ele ainda estiver aqui no início de setembro, entrarei em contato com o Github e / ou patch PyGithub.

Apreciar,

Para melhorar um pouco a solução alternativa, você pode fazer isso para determinar se um problema é um PR ou não (porque todos os PRs também são problemas):

        if myIssue.pull_request.diff_url:
            PR=True
        else:
            PR=False

Obrigada! Irá usar isso como uma solução alternativa.

Acabei de entrar em contato com o Github para esse problema.

E aqui está a resposta que recebi do Github:

From: Wynn Netherland
Subject: API v3, list comments on pull requests

Hi, Vincent. I know it's confusing but we actually have three types of comments on GitHub, so there are
three different spots in the API to grab them. Be sure you're looking in the right spot for the data you expect.

Pull Request comments are the top-level comments found on the Pull Request page. These are retrieved via
the Issues API [1] since PRs are essentially specialized Issues. Pull Request review comments are those made
against the diff on the PR. You can grab these with the Review Comments API [2]. Finally, line comments made
outside the context of a PR on a raw commit can be retrieved via the Commit Comments API [3].

Armed with that info, let me know if you're not seeing the data you expect and the API call you're making, and I
can dig a bit deeper.

[1] http://developer.github.com/v3/issues/comments/
[2] http://developer.github.com/v3/pulls/comments/
[3] http://developer.github.com/v3/repos/comments/

Cheers,

Então, isso é coerente com o que podemos ver aqui: https://github.com/jacquev6/PyGithub/pull/57 , já que PullRequest.get_comments usa a API Pull Requests. @ nixoz2k7 Também é coerente com o seu problema original?

De qualquer forma, isso é enganoso, então adicionarei dois métodos chamados get_issue_comments (usando a API de problemas) e get_review_comments (sinônimo de get_comments , usando a API de solicitações de pull). Espere isso para o meio da próxima semana.

Acabei de enviar os novos métodos em https://github.com/jacquev6/PyGithub/tree/develop. Fecho o problema porque sinto que está resolvido. @ nixoz2k7 , não hesite em

Muito obrigado ;)
aliás, ele funciona muito bem com a solução alternativa de "problemas". estável por 2 semanas já.

Obrigado novamente.
Sergey.

Esta página foi útil?
0 / 5 - 0 avaliações