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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
011558ea
Commit
011558ea
authored
Nov 16, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logs for monitoring the merge process
parent
304ceb14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
app/services/merge_requests/merge_service.rb
app/services/merge_requests/merge_service.rb
+12
-0
changelogs/unreleased/osw-merge-process-logs.yml
changelogs/unreleased/osw-merge-process-logs.yml
+5
-0
No files found.
app/services/merge_requests/merge_service.rb
View file @
011558ea
...
@@ -10,6 +10,8 @@ module MergeRequests
...
@@ -10,6 +10,8 @@ module MergeRequests
attr_reader
:merge_request
,
:source
attr_reader
:merge_request
,
:source
delegate
:merge_jid
,
:state
,
to: :@merge_request
def
execute
(
merge_request
)
def
execute
(
merge_request
)
if
project
.
merge_requests_ff_only_enabled
&&
!
self
.
is_a?
(
FfMergeService
)
if
project
.
merge_requests_ff_only_enabled
&&
!
self
.
is_a?
(
FfMergeService
)
FfMergeService
.
new
(
project
,
current_user
,
params
).
execute
(
merge_request
)
FfMergeService
.
new
(
project
,
current_user
,
params
).
execute
(
merge_request
)
...
@@ -35,6 +37,7 @@ module MergeRequests
...
@@ -35,6 +37,7 @@ module MergeRequests
success
success
end
end
end
end
log_info
(
"Merge process finished on JID
#{
merge_jid
}
with state
#{
state
}
"
)
rescue
MergeError
=>
e
rescue
MergeError
=>
e
handle_merge_error
(
log_message:
e
.
message
,
save_message_on_model:
true
)
handle_merge_error
(
log_message:
e
.
message
,
save_message_on_model:
true
)
end
end
...
@@ -44,7 +47,9 @@ module MergeRequests
...
@@ -44,7 +47,9 @@ module MergeRequests
def
commit
def
commit
message
=
params
[
:commit_message
]
||
merge_request
.
merge_commit_message
message
=
params
[
:commit_message
]
||
merge_request
.
merge_commit_message
log_info
(
"Git merge started on JID
#{
merge_jid
}
"
)
commit_id
=
repository
.
merge
(
current_user
,
source
,
merge_request
,
message
)
commit_id
=
repository
.
merge
(
current_user
,
source
,
merge_request
,
message
)
log_info
(
"Git merge finished on JID
#{
merge_jid
}
commit
#{
commit_id
}
"
)
raise
MergeError
,
'Conflicts detected during merge'
unless
commit_id
raise
MergeError
,
'Conflicts detected during merge'
unless
commit_id
...
@@ -58,7 +63,9 @@ module MergeRequests
...
@@ -58,7 +63,9 @@ module MergeRequests
end
end
def
after_merge
def
after_merge
log_info
(
"Post merge started on JID
#{
merge_jid
}
with state
#{
state
}
"
)
MergeRequests
::
PostMergeService
.
new
(
project
,
current_user
).
execute
(
merge_request
)
MergeRequests
::
PostMergeService
.
new
(
project
,
current_user
).
execute
(
merge_request
)
log_info
(
"Post merge finished on JID
#{
merge_jid
}
with state
#{
state
}
"
)
if
delete_source_branch?
if
delete_source_branch?
DeleteBranchService
.
new
(
@merge_request
.
source_project
,
branch_deletion_user
)
DeleteBranchService
.
new
(
@merge_request
.
source_project
,
branch_deletion_user
)
...
@@ -94,5 +101,10 @@ module MergeRequests
...
@@ -94,5 +101,10 @@ module MergeRequests
def
find_merge_source
def
find_merge_source
merge_request
.
diff_head_sha
merge_request
.
diff_head_sha
end
end
def
log_info
(
message
)
@logger
||=
Rails
.
logger
@logger
.
info
(
message
)
end
end
end
end
end
changelogs/unreleased/osw-merge-process-logs.yml
0 → 100644
View file @
011558ea
---
title
:
Add logs for monitoring the merge process
merge_request
:
author
:
type
:
other
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