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
72e536b5
Commit
72e536b5
authored
Sep 07, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect rebase state based on rebase directory
parent
7c12a8d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
app/models/merge_request.rb
app/models/merge_request.rb
+8
-0
app/services/merge_requests/rebase_service.rb
app/services/merge_requests/rebase_service.rb
+6
-1
app/views/projects/merge_requests/widget/open/_ff_accept.html.haml
.../projects/merge_requests/widget/open/_ff_accept.html.haml
+6
-3
No files found.
app/models/merge_request.rb
View file @
72e536b5
...
...
@@ -506,4 +506,12 @@ class MergeRequest < ActiveRecord::Base
def
ff_merge_possible?
target_sha
==
source_sha_parent
end
def
rebase_dir_path
Rails
.
root
.
join
(
'tmp'
,
'rebase'
,
source_project
.
id
.
to_s
,
id
.
to_s
).
to_s
end
def
rebase_in_progress?
File
.
exist?
(
rebase_dir_path
)
end
end
app/services/merge_requests/rebase_service.rb
View file @
72e536b5
...
...
@@ -52,6 +52,7 @@ module MergeRequests
true
ensure
clean_dir
Gitlab
::
ShellEnv
.
reset_env
end
...
...
@@ -64,11 +65,15 @@ module MergeRequests
end
def
tree_path
@tree_path
||=
Rails
.
root
.
join
(
'tmp'
,
'rebase'
,
source_project
.
id
.
to_s
,
SecureRandom
.
hex
).
to_s
@tree_path
||=
merge_request
.
rebase_dir_path
end
def
log
(
message
)
Gitlab
::
GitLogger
.
error
(
message
)
end
def
clean_dir
FileUtils
.
rm_rf
(
tree_path
)
if
File
.
exist?
(
tree_path
)
end
end
end
app/views/projects/merge_requests/widget/open/_ff_accept.html.haml
View file @
72e536b5
...
...
@@ -14,9 +14,12 @@
=
hidden_field_tag
:authenticity_token
,
form_authenticity_token
.accept-merge-holder.clearfix.js-toggle-container
-
if
@merge_request
.
target_project
.
merge_requests_rebase_enabled
&&
can_rebase?
(
@merge_request
.
target_project
,
@merge_request
.
target_branch
)
.accept-action
=
f
.
button
class:
"btn btn-reopen rebase-mr"
do
Rebase from
#{
@merge_request
.
target_branch
}
-
if
@merge_request
.
rebase_in_progress?
%h4
Rebase in progress... It can take a while. Reload at will.
-
else
.accept-action
=
f
.
button
class:
"btn btn-reopen rebase-mr"
do
Rebase from
#{
@merge_request
.
target_branch
}
.accept-control
Fast-forward merge is not possible. Branch must be rebased first
...
...
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