summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Lucarella <leandro.lucarella@sociomantic.com>2014-04-25 18:25:31 +0200
committerMihails Strasuns <mihails.strasuns@sociomantic.com>2014-04-30 11:07:33 +0200
commita451683a1655262cd9f5fe1766558e4589a9f1e1 (patch)
tree8c8120bd888ae2063d0d5e42c44a3f14ed424d34
parentd2c5da0f14c503ee115871784fcc77c09dd8a1cb (diff)
pull show: Show both regular and code comments
Fixes #83 and also retrieve labels for pull requests.
-rwxr-xr-xgit-hub19
1 files changed, 18 insertions, 1 deletions
diff --git a/git-hub b/git-hub
index e8aae5d..6a35cf4 100755
--- a/git-hub
+++ b/git-hub
@@ -1164,7 +1164,24 @@ class PullCmd (IssueCmd):
class ShowCmd (PullUtil, IssueCmd.ShowCmd):
cmd_help = "show details for existing pull requests"
- pass
+ @classmethod
+ def run(cls, parser, args):
+ for n in args.issues:
+ pull = req.get(cls.url(n))
+ # Damn GitHub doesn't provide labels for
+ # pull request objects
+ issue_url = '/repos/%s/issues/%s' % (
+ config.upstream, n)
+ issue = req.get(issue_url)
+ pull['labels'] = issue.get('labels', [])
+ c = []
+ if pull['comments'] > 0:
+ c = req.get(issue_url + '/comments')
+ if pull['review_comments'] > 0:
+ ic = req.get(cls.url(n) + "/comments")
+ c.extend(ic)
+ c.sort(key=lambda i: i['created_at'])
+ cls.print_issue(pull, c)
class UpdateCmd (PullUtil, IssueCmd.UpdateCmd):
cmd_help = "update an existing pull request"