Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
53912014
Commit
53912014
authored
8 years ago
by
ilovezfs
Browse files
Options
Downloads
Patches
Plain Diff
bump-formula-pr: block duplicate pull-requests
parent
08c75616
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Homebrew/dev-cmd/bump-formula-pr.rb
+37
-0
37 additions, 0 deletions
Library/Homebrew/dev-cmd/bump-formula-pr.rb
with
37 additions
and
0 deletions
Library/Homebrew/dev-cmd/bump-formula-pr.rb
+
37
−
0
View file @
53912014
...
...
@@ -78,8 +78,43 @@ module Homebrew
end
end
def
fetch_pull_requests
(
formula
)
GitHub
.
issues_for_formula
(
formula
.
name
,
tap:
formula
.
tap
).
select
do
|
pr
|
pr
[
"html_url"
].
include?
(
"/pull/"
)
end
rescue
GitHub
::
RateLimitExceededError
=>
e
opoo
e
.
message
[]
end
def
check_for_duplicate_pull_requests
(
formula
)
pull_requests
=
fetch_pull_requests
(
formula
)
return
unless
pull_requests
&&
!
pull_requests
.
empty?
duplicates_message
=
<<-
EOS
.
undent
These open pull requests may be duplicates:
#{
pull_requests
.
map
{
|
pr
|
"
#{
pr
[
"title"
]
}
#{
pr
[
"html_url"
]
}
"
}
.join("
\n
")}
EOS
error_message
=
"Duplicate PRs should not be opened. Use --force to override this error."
if
ARGV
.
force?
&&
!
ARGV
.
flag?
(
"--quiet"
)
opoo
duplicates_message
elsif
!
ARGV
.
force?
&&
ARGV
.
flag?
(
"--quiet"
)
odie
error_message
elsif
!
ARGV
.
force?
odie
<<-
EOS
.
undent
#{
duplicates_message
.
chomp
}
#{
error_message
}
EOS
end
end
def
bump_formula_pr
formula
=
ARGV
.
formulae
.
first
if
formula
check_for_duplicate_pull_requests
(
formula
)
checked_for_duplicates
=
true
end
new_url
=
ARGV
.
value
(
"url"
)
if
new_url
&&
!
formula
is_devel
=
ARGV
.
include?
(
"--devel"
)
...
...
@@ -101,6 +136,8 @@ module Homebrew
end
odie
"No formula found!"
unless
formula
check_for_duplicate_pull_requests
(
formula
)
unless
checked_for_duplicates
requested_spec
,
formula_spec
=
if
ARGV
.
include?
(
"--devel"
)
devel_message
=
" (devel)"
[
:devel
,
formula
.
devel
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment