Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3c2d6b48
Commit
3c2d6b48
authored
Sep 28, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a class that represents a git push operation
parent
ba66e0cc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
app/services/merge_requests/base_service.rb
app/services/merge_requests/base_service.rb
+3
-3
lib/gitlab/git/push.rb
lib/gitlab/git/push.rb
+25
-0
No files found.
app/services/merge_requests/base_service.rb
View file @
3c2d6b48
...
...
@@ -57,10 +57,10 @@ module MergeRequests
# Returns all origin and fork merge requests from `@project` satisfying passed arguments.
# rubocop: disable CodeReuse/ActiveRecord
def
merge_requests_for
(
source_branch
,
mr_states:
[
:opened
])
MergeRequest
@project
.
source_of_merge_requests
.
with_state
(
mr_states
)
.
where
(
source_branch:
source_branch
,
source_project_id:
@project
.
id
)
.
preload
(
:source_project
)
# we don't need
a
#includes since we're just preloading for the #select
.
where
(
source_branch:
source_branch
)
.
preload
(
:source_project
)
# we don't need #includes since we're just preloading for the #select
.
select
(
&
:source_project
)
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
lib/gitlab/git/push.rb
0 → 100644
View file @
3c2d6b48
# frozen_string_literal: true
module
Gitlab
module
Git
class
Push
def
initialize
(
project
,
oldrev
,
newrev
,
ref
)
@project
,
@oldrev
,
@newrev
=
project
,
oldrev
,
newrev
@repository
=
project
.
repository
@branch_name
=
Gitlab
::
Git
.
ref_name
(
ref
)
end
def
branch_added?
Gitlab
::
Git
.
blank_ref?
(
@oldrev
)
end
def
branch_removed?
Gitlab
::
Git
.
blank_ref?
(
@newrev
)
end
def
force_push?
Gitlab
::
Checks
::
ForcePush
.
force_push?
(
@project
,
@oldrev
,
@newrev
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment