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
96c02551
Commit
96c02551
authored
Mar 03, 2016
by
tiagonbotelho
Committed by
Yorick Peterse
Mar 07, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moves the main_language update logic to git push service
parent
8039bbf7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
app/models/project.rb
app/models/project.rb
+0
-8
app/services/git_push_service.rb
app/services/git_push_service.rb
+12
-0
No files found.
app/models/project.rb
View file @
96c02551
...
@@ -86,14 +86,6 @@ class Project < ActiveRecord::Base
...
@@ -86,14 +86,6 @@ class Project < ActiveRecord::Base
end
end
end
end
# checks if the language main language of the project changed
before_save
:check_main_language
def
check_main_language
if
commit_count_changed?
main_language
=
repository
.
main_language
end
end
ActsAsTaggableOn
.
strict_case_match
=
true
ActsAsTaggableOn
.
strict_case_match
=
true
acts_as_taggable_on
:tags
acts_as_taggable_on
:tags
...
...
app/services/git_push_service.rb
View file @
96c02551
...
@@ -14,6 +14,7 @@ class GitPushService < BaseService
...
@@ -14,6 +14,7 @@ class GitPushService < BaseService
# 3. Recognizes cross-references from commit messages
# 3. Recognizes cross-references from commit messages
# 4. Executes the project's web hooks
# 4. Executes the project's web hooks
# 5. Executes the project's services
# 5. Executes the project's services
# 6. Checks if the project's main language has changed
#
#
def
execute
def
execute
@project
.
repository
.
after_push_commit
(
branch_name
)
@project
.
repository
.
after_push_commit
(
branch_name
)
...
@@ -42,6 +43,9 @@ class GitPushService < BaseService
...
@@ -42,6 +43,9 @@ class GitPushService < BaseService
@push_commits
=
@project
.
repository
.
commits_between
(
params
[
:oldrev
],
params
[
:newrev
])
@push_commits
=
@project
.
repository
.
commits_between
(
params
[
:oldrev
],
params
[
:newrev
])
process_commit_messages
process_commit_messages
end
end
# Checks if the main language has changed in the project and if so
# it updates it accordingly
update_main_language
# Update merge requests that may be affected by this push. A new branch
# Update merge requests that may be affected by this push. A new branch
# could cause the last commit of a merge request to change.
# could cause the last commit of a merge request to change.
update_merge_requests
update_merge_requests
...
@@ -49,6 +53,14 @@ class GitPushService < BaseService
...
@@ -49,6 +53,14 @@ class GitPushService < BaseService
protected
protected
def
update_main_language
current_language
=
@project
.
repository
.
main_language
unless
current_language
==
@project
.
main_language
@project
.
update_attributes
(
main_language:
current_language
)
end
end
def
update_merge_requests
def
update_merge_requests
@project
.
update_merge_requests
(
params
[
:oldrev
],
params
[
:newrev
],
params
[
:ref
],
current_user
)
@project
.
update_merge_requests
(
params
[
:oldrev
],
params
[
:newrev
],
params
[
:ref
],
current_user
)
...
...
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