Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

support optional branch name

  • Loading branch information...
commit e556d9f5871df5fbedb81f2a9bc35fd8a19dd664 1 parent 11e3471
@jianli authored
Showing with 4 additions and 3 deletions.
  1. +2 −1  lib/hub/commands.rb
  2. +2 −2 lib/hub/github_api.rb
View
3  lib/hub/commands.rb
@@ -96,7 +96,8 @@ def pull_request(args)
while arg = args.shift
case arg
when '-l'
- pull_data = api_client.get_pullrequest(base_project, current_branch)
+ branch_name = args.shift || current_branch.short_name
+ pull_data = api_client.get_pullrequest(base_project, branch_name)
if pull_data
puts pull_data
end
View
4 lib/hub/github_api.rb
@@ -110,7 +110,7 @@ def create_pullrequest options
end
# Return the pull request corresponding to the current branch
- def get_pullrequest project, current_branch
+ def get_pullrequest project, branch_name
page = 1
res = nil
while page == 1 or res.data.length > 0
@@ -118,7 +118,7 @@ def get_pullrequest project, current_branch
[api_host(project.host), project.owner, project.name, page]
res.error! unless res.success?
res.data.each { |x|
- if current_branch.short_name == x['head']['label'].split(':', 0)[1]
+ if branch_name == x['head']['label'].split(':', 0)[1]
return x['html_url']
end
}
Please sign in to comment.
Something went wrong with that request. Please try again.