git_pr 0.0.3.beta1 → 0.0.3.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 658d65e69d1e82754cf3a52a1dbc2acb6f7e6c7f
4
- data.tar.gz: e4755905156ddc6de7dde59f8cdc244daeec8258
3
+ metadata.gz: f007a6246a5d8188043fa4f245f508ff49346647
4
+ data.tar.gz: 6dba6dd1e4fe153a0b7258af176dc901d2d9750b
5
5
  SHA512:
6
- metadata.gz: 076c502311bb4c1cd68c82a22dadd5cbffa3ee7df1f5cafb1e638f64293707281b58f7e8532aefc57fde4a96f8971c8439717339464931e94b463ab87b3d1a3c
7
- data.tar.gz: 78e4a335f11d88519db214dfeaabf1a824fbd97a4070b4242bf3edda6131346f7b067d765d7e11f94c3c8ec1cad27b4ce015553694d790744ca311bd6a83f056
6
+ metadata.gz: 8fc6a3bc87581d4d6f761a3436e00ff5eaf1910eeecfa64e3ca7906f9c9b3693aee52ee2aeffd7ad3d6a4687e91bcf09dfa7b9661ce36dd9820585567f32a50b
7
+ data.tar.gz: da8fcf7f4e3e23e3dc98240103d4923910ef6842e6d6acfe09105c88f00ec27ae36b82d3ee83d095e309dfa6cb9b2fe718878af12eb8503db33742ec97156037
data/bin/git-pr CHANGED
@@ -18,9 +18,11 @@ require 'ostruct'
18
18
  require 'pp'
19
19
 
20
20
  $verbose = false
21
+ $default_remotes = ["origin", "upstream"]
22
+
21
23
  options = OpenStruct.new(:help => false,
22
24
  :verbose => false,
23
- :project => "origin",
25
+ :project => nil,
24
26
  :pull_request => nil,
25
27
  :diff => OpenStruct.new(),
26
28
  :difftool => OpenStruct.new(),
@@ -40,8 +42,8 @@ eos
40
42
  opts.on("-p",
41
43
  "--project [REMOTE|PROJECT]",
42
44
  "The GitHub project to access. Can be a named remote, or a GitHub project in",
43
- "<user>/<project> form. Defaults to the GitHub project that the \"origin\" remote",
44
- "points to.") do |project|
45
+ "<user>/<project> form. Defaults to the GitHub project that the \"origin\"",
46
+ "or \"upstream\" remote points to.") do |project|
45
47
  options.project = project
46
48
  end
47
49
  opts.on("-h", "--help", "Show help") do
@@ -153,7 +155,7 @@ def pull_summary(pull)
153
155
  end
154
156
 
155
157
  # Figure out what GitHub project we're dealing with.
156
- github_project = GitPr::GitHub.determine_project_name_from_command_line git, options.project
158
+ github_project = GitPr::GitHub.determine_project_name_from_command_line git, options.project, $default_remotes
157
159
 
158
160
  case command
159
161
 
data/lib/git_pr/github.rb CHANGED
@@ -78,14 +78,18 @@ module GitPr
78
78
  end
79
79
  end
80
80
 
81
- def self.determine_project_name_from_command_line git, project_name
81
+ def self.determine_project_name_from_command_line git, project_name, default_remotes
82
82
  # Figure out what GitHub project we're dealing with. First, did they pass us a name of
83
83
  # an existing remote, or did they pass a GitHub project?
84
- project_remote = git.remotes.find { |x| x.name == project_name }
84
+ if project_name
85
+ project_remote = git.remotes.find { |x| x.name == project_name }
86
+ else
87
+ project_remote = git.remotes.find { |x| default_remotes.include? x.name }
88
+ end
85
89
  if project_remote
86
90
  url_match = project_remote.url.match "^git@github.com:(.*).git"
87
91
  unless url_match
88
- puts "Specified project '#{options.project}' is not a GitHub remote.".red
92
+ puts "Specified remote '#{project_remote}' is not a GitHub remote.".red
89
93
  exit -1
90
94
  end
91
95
  github_project = url_match[1]
@@ -1,3 +1,3 @@
1
1
  module GitPr
2
- VERSION = "0.0.3.beta1"
2
+ VERSION = "0.0.3.beta2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_pr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.beta1
4
+ version: 0.0.3.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Sharon