git_pr 0.0.3.beta1 → 0.0.3.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/git-pr +6 -4
- data/lib/git_pr/github.rb +7 -3
- data/lib/git_pr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f007a6246a5d8188043fa4f245f508ff49346647
|
4
|
+
data.tar.gz: 6dba6dd1e4fe153a0b7258af176dc901d2d9750b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =>
|
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\"
|
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
|
-
|
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
|
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]
|
data/lib/git_pr/version.rb
CHANGED