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
3ae31798
Commit
3ae31798
authored
Dec 27, 2017
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed rebase from EE
parent
71280599
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
15 additions
and
428 deletions
+15
-428
ee/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue
...rge_request_widget/components/states/mr_widget_rebase.vue
+0
-132
ee/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
...javascripts/vue_merge_request_widget/mr_widget_options.js
+0
-2
ee/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
...ts/vue_merge_request_widget/services/mr_widget_service.js
+0
-5
ee/app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js
...ascripts/vue_merge_request_widget/stores/get_state_key.js
+0
-4
ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+0
-8
ee/app/assets/javascripts/vue_merge_request_widget/stores/state_maps.js
...javascripts/vue_merge_request_widget/stores/state_maps.js
+0
-2
ee/app/controllers/ee/projects/merge_requests_controller.rb
ee/app/controllers/ee/projects/merge_requests_controller.rb
+0
-21
ee/app/models/ee/merge_request.rb
ee/app/models/ee/merge_request.rb
+0
-7
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+0
-5
ee/app/models/ee/repository.rb
ee/app/models/ee/repository.rb
+0
-7
ee/app/models/license.rb
ee/app/models/license.rb
+0
-2
ee/app/services/merge_requests/rebase_service.rb
ee/app/services/merge_requests/rebase_service.rb
+0
-30
ee/app/services/merge_requests/working_copy_base_service.rb
ee/app/services/merge_requests/working_copy_base_service.rb
+0
-24
ee/app/views/projects/ee/_merge_request_fast_forward_settings.html.haml
...rojects/ee/_merge_request_fast_forward_settings.html.haml
+0
-14
ee/app/views/projects/ee/_merge_request_rebase_settings.html.haml
...iews/projects/ee/_merge_request_rebase_settings.html.haml
+0
-13
ee/app/views/projects/ee/_merge_request_settings.html.haml
ee/app/views/projects/ee/_merge_request_settings.html.haml
+2
-2
ee/app/workers/rebase_worker.rb
ee/app/workers/rebase_worker.rb
+0
-12
spec/ee/spec/controllers/projects/merge_requests_controller_spec.rb
...ec/controllers/projects/merge_requests_controller_spec.rb
+0
-47
spec/ee/spec/models/ee/merge_request_spec.rb
spec/ee/spec/models/ee/merge_request_spec.rb
+0
-60
spec/ee/spec/models/ee/project_spec.rb
spec/ee/spec/models/ee/project_spec.rb
+0
-25
spec/models/project_spec.rb
spec/models/project_spec.rb
+13
-6
No files found.
ee/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue
deleted
100644 → 0
View file @
71280599
<
script
>
import
simplePoll
from
'
~/lib/utils/simple_poll
'
;
import
eventHub
from
'
~/vue_merge_request_widget/event_hub
'
;
import
statusIcon
from
'
~/vue_merge_request_widget/components/mr_widget_status_icon
'
;
import
loadingIcon
from
'
~/vue_shared/components/loading_icon.vue
'
;
import
Flash
from
'
~/flash
'
;
export
default
{
props
:
{
mr
:
{
type
:
Object
,
required
:
true
,
},
service
:
{
type
:
Object
,
required
:
true
,
},
},
components
:
{
statusIcon
,
loadingIcon
,
},
data
()
{
return
{
isMakingRequest
:
false
,
rebasingError
:
null
,
};
},
computed
:
{
status
()
{
if
(
this
.
mr
.
rebaseInProgress
||
this
.
isMakingRequest
)
{
return
'
loading
'
;
}
if
(
!
this
.
mr
.
canPushToSourceBranch
&&
!
this
.
mr
.
rebaseInProgress
)
{
return
'
warning
'
;
}
return
'
success
'
;
},
showDisabledButton
()
{
return
[
'
failed
'
,
'
loading
'
].
includes
(
this
.
status
);
},
},
methods
:
{
rebase
()
{
this
.
isMakingRequest
=
true
;
this
.
rebasingError
=
null
;
this
.
service
.
rebase
()
.
then
(()
=>
{
simplePoll
(
this
.
checkRebaseStatus
);
})
.
catch
((
error
)
=>
{
this
.
rebasingError
=
error
.
merge_error
;
this
.
isMakingRequest
=
false
;
Flash
(
'
Something went wrong. Please try again.
'
);
});
},
checkRebaseStatus
(
continuePolling
,
stopPolling
)
{
this
.
service
.
poll
()
.
then
(
res
=>
res
.
data
)
.
then
((
res
)
=>
{
if
(
res
.
rebase_in_progress
)
{
continuePolling
();
}
else
{
this
.
isMakingRequest
=
false
;
if
(
res
.
merge_error
&&
res
.
merge_error
.
length
)
{
this
.
rebasingError
=
res
.
merge_error
;
Flash
(
'
Something went wrong. Please try again.
'
);
}
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
);
stopPolling
();
}
})
.
catch
(()
=>
{
this
.
isMakingRequest
=
false
;
Flash
(
'
Something went wrong. Please try again.
'
);
stopPolling
();
});
},
},
};
</
script
>
<
template
>
<div
class=
"mr-widget-body media"
>
<status-icon
:status=
"status"
:show-disabled-button=
"showDisabledButton"
/>
<div
class=
"rebase-state-find-class-convention media media-body space-children"
>
<template
v-if=
"mr.rebaseInProgress || isMakingRequest"
>
<span
class=
"bold"
>
Rebase in progress
</span>
</
template
>
<
template
v-if=
"!mr.rebaseInProgress && !mr.canPushToSourceBranch"
>
<span
class=
"bold"
>
Fast-forward merge is not possible.
Rebase the source branch onto
<span
class=
"label-branch"
>
{{
mr
.
targetBranch
}}
</span>
to allow this merge request to be merged.
</span>
</
template
>
<
template
v-if=
"!mr.rebaseInProgress && mr.canPushToSourceBranch && !isMakingRequest"
>
<div
class=
"accept-merge-holder clearfix js-toggle-container accept-action media space-children"
>
<button
type=
"button"
class=
"btn btn-sm btn-reopen btn-success"
:disabled=
"isMakingRequest"
@
click=
"rebase"
>
<loading-icon
v-if=
"isMakingRequest"
/>
Rebase
</button>
<span
v-if=
"!rebasingError"
class=
"bold"
>
Fast-forward merge is not possible.
Rebase the source branch onto the target branch or merge target
branch into source branch to allow this merge request to be merged.
</span>
<span
v-else
class=
"bold danger"
>
{{
rebasingError
}}
</span>
</div>
</
template
>
</div>
</div>
</template>
ee/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
View file @
3ae31798
...
@@ -2,7 +2,6 @@ import { n__, s__, sprintf } from '~/locale';
...
@@ -2,7 +2,6 @@ import { n__, s__, sprintf } from '~/locale';
import
CEWidgetOptions
from
'
~/vue_merge_request_widget/mr_widget_options
'
;
import
CEWidgetOptions
from
'
~/vue_merge_request_widget/mr_widget_options
'
;
import
WidgetApprovals
from
'
./components/approvals/mr_widget_approvals
'
;
import
WidgetApprovals
from
'
./components/approvals/mr_widget_approvals
'
;
import
GeoSecondaryNode
from
'
./components/states/mr_widget_secondary_geo_node
'
;
import
GeoSecondaryNode
from
'
./components/states/mr_widget_secondary_geo_node
'
;
import
RebaseState
from
'
./components/states/mr_widget_rebase.vue
'
;
import
collapsibleSection
from
'
./components/mr_widget_report_collapsible_section.vue
'
;
import
collapsibleSection
from
'
./components/mr_widget_report_collapsible_section.vue
'
;
export
default
{
export
default
{
...
@@ -10,7 +9,6 @@ export default {
...
@@ -10,7 +9,6 @@ export default {
components
:
{
components
:
{
'
mr-widget-approvals
'
:
WidgetApprovals
,
'
mr-widget-approvals
'
:
WidgetApprovals
,
'
mr-widget-geo-secondary-node
'
:
GeoSecondaryNode
,
'
mr-widget-geo-secondary-node
'
:
GeoSecondaryNode
,
'
mr-widget-rebase
'
:
RebaseState
,
collapsibleSection
,
collapsibleSection
,
},
},
data
()
{
data
()
{
...
...
ee/app/assets/javascripts/vue_merge_request_widget/services/mr_widget_service.js
View file @
3ae31798
...
@@ -7,7 +7,6 @@ export default class MRWidgetService extends CEWidgetService {
...
@@ -7,7 +7,6 @@ export default class MRWidgetService extends CEWidgetService {
super
(
mr
);
super
(
mr
);
this
.
approvalsPath
=
mr
.
approvalsPath
;
this
.
approvalsPath
=
mr
.
approvalsPath
;
this
.
rebasePath
=
mr
.
rebasePath
;
}
}
fetchApprovals
()
{
fetchApprovals
()
{
...
@@ -25,10 +24,6 @@ export default class MRWidgetService extends CEWidgetService {
...
@@ -25,10 +24,6 @@ export default class MRWidgetService extends CEWidgetService {
.
then
(
res
=>
res
.
data
);
.
then
(
res
=>
res
.
data
);
}
}
rebase
()
{
return
axios
.
post
(
this
.
rebasePath
);
}
fetchReport
(
endpoint
)
{
// eslint-disable-line
fetchReport
(
endpoint
)
{
// eslint-disable-line
return
axios
.
get
(
endpoint
)
return
axios
.
get
(
endpoint
)
.
then
(
res
=>
res
.
data
);
.
then
(
res
=>
res
.
data
);
...
...
ee/app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js
View file @
3ae31798
...
@@ -5,10 +5,6 @@ export default function (data) {
...
@@ -5,10 +5,6 @@ export default function (data) {
return
'
geoSecondaryNode
'
;
return
'
geoSecondaryNode
'
;
}
}
if
(
this
.
shouldBeRebased
)
{
return
'
rebase
'
;
}
return
CEGetStateKey
.
call
(
this
,
data
);
return
CEGetStateKey
.
call
(
this
,
data
);
}
}
ee/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
3ae31798
...
@@ -12,7 +12,6 @@ export default class MergeRequestStore extends CEMergeRequestStore {
...
@@ -12,7 +12,6 @@ export default class MergeRequestStore extends CEMergeRequestStore {
setData
(
data
)
{
setData
(
data
)
{
this
.
initGeo
(
data
);
this
.
initGeo
(
data
);
this
.
initSquashBeforeMerge
(
data
);
this
.
initSquashBeforeMerge
(
data
);
this
.
initRebase
(
data
);
this
.
initApprovals
(
data
);
this
.
initApprovals
(
data
);
super
.
setData
(
data
);
super
.
setData
(
data
);
...
@@ -25,13 +24,6 @@ export default class MergeRequestStore extends CEMergeRequestStore {
...
@@ -25,13 +24,6 @@ export default class MergeRequestStore extends CEMergeRequestStore {
||
data
.
enable_squash_before_merge
;
||
data
.
enable_squash_before_merge
;
}
}
initRebase
(
data
)
{
this
.
canPushToSourceBranch
=
data
.
can_push_to_source_branch
;
this
.
rebaseInProgress
=
data
.
rebase_in_progress
;
this
.
approvalsLeft
=
!
data
.
approved
;
this
.
rebasePath
=
data
.
rebase_path
;
}
initGeo
(
data
)
{
initGeo
(
data
)
{
this
.
isGeoSecondaryNode
=
this
.
isGeoSecondaryNode
||
data
.
is_geo_secondary_node
;
this
.
isGeoSecondaryNode
=
this
.
isGeoSecondaryNode
||
data
.
is_geo_secondary_node
;
this
.
geoSecondaryHelpPath
=
this
.
geoSecondaryHelpPath
||
data
.
geo_secondary_help_path
;
this
.
geoSecondaryHelpPath
=
this
.
geoSecondaryHelpPath
||
data
.
geo_secondary_help_path
;
...
...
ee/app/assets/javascripts/vue_merge_request_widget/stores/state_maps.js
View file @
3ae31798
import
stateMaps
from
'
~/vue_merge_request_widget/stores/state_maps
'
;
import
stateMaps
from
'
~/vue_merge_request_widget/stores/state_maps
'
;
stateMaps
.
stateToComponentMap
.
geoSecondaryNode
=
'
mr-widget-geo-secondary-node
'
;
stateMaps
.
stateToComponentMap
.
geoSecondaryNode
=
'
mr-widget-geo-secondary-node
'
;
stateMaps
.
stateToComponentMap
.
rebase
=
'
mr-widget-rebase
'
;
stateMaps
.
statesToShowHelpWidget
.
push
(
'
rebase
'
);
export
default
{
export
default
{
stateToComponentMap
:
stateMaps
.
stateToComponentMap
,
stateToComponentMap
:
stateMaps
.
stateToComponentMap
,
...
...
ee/app/controllers/ee/projects/merge_requests_controller.rb
View file @
3ae31798
...
@@ -3,17 +3,6 @@ module EE
...
@@ -3,17 +3,6 @@ module EE
module
MergeRequestsController
module
MergeRequestsController
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
prepended
do
before_action
:check_merge_request_rebase_available!
,
only:
[
:rebase
]
before_action
:check_user_can_push_to_source_branch!
,
only:
[
:rebase
]
end
def
rebase
RebaseWorker
.
perform_async
(
merge_request
.
id
,
current_user
.
id
)
render
nothing:
true
,
status:
200
end
def
approve
def
approve
unless
merge_request
.
can_approve?
(
current_user
)
unless
merge_request
.
can_approve?
(
current_user
)
return
render_404
return
render_404
...
@@ -63,16 +52,6 @@ module EE
...
@@ -63,16 +52,6 @@ module EE
attrs
attrs
end
end
def
check_user_can_push_to_source_branch!
return
access_denied!
unless
merge_request
.
source_branch_exists?
access_check
=
::
Gitlab
::
UserAccess
.
new
(
current_user
,
project:
merge_request
.
source_project
)
.
can_push_to_branch?
(
merge_request
.
source_branch
)
access_denied!
unless
access_check
end
end
end
end
end
end
end
ee/app/models/ee/merge_request.rb
View file @
3ae31798
...
@@ -19,13 +19,6 @@ module EE
...
@@ -19,13 +19,6 @@ module EE
delegate
:sha
,
to: :base_pipeline
,
prefix: :base_pipeline
,
allow_nil:
true
delegate
:sha
,
to: :base_pipeline
,
prefix: :base_pipeline
,
allow_nil:
true
end
end
def
rebase_in_progress?
# The source project can be deleted
return
false
unless
source_project
source_project
.
repository
.
rebase_in_progress?
(
id
)
end
def
squash_in_progress?
def
squash_in_progress?
# The source project can be deleted
# The source project can be deleted
return
false
unless
source_project
return
false
unless
source_project
...
...
ee/app/models/ee/project.rb
View file @
3ae31798
...
@@ -419,11 +419,6 @@ module EE
...
@@ -419,11 +419,6 @@ module EE
super
unless
mirror?
super
unless
mirror?
end
end
def
merge_requests_rebase_enabled
super
&&
feature_available?
(
:merge_request_rebase
)
end
alias_method
:merge_requests_rebase_enabled?
,
:merge_requests_rebase_enabled
def
merge_requests_ff_only_enabled
def
merge_requests_ff_only_enabled
super
super
end
end
...
...
ee/app/models/ee/repository.rb
View file @
3ae31798
...
@@ -31,13 +31,6 @@ module EE
...
@@ -31,13 +31,6 @@ module EE
refs
.
map
{
|
sha
|
commit
(
sha
.
strip
)
}
refs
.
map
{
|
sha
|
commit
(
sha
.
strip
)
}
end
end
def
rebase
(
user
,
merge_request
)
raw
.
rebase
(
user
,
merge_request
.
id
,
branch:
merge_request
.
source_branch
,
branch_sha:
merge_request
.
source_branch_sha
,
remote_repository:
merge_request
.
target_project
.
repository
.
raw
,
remote_branch:
merge_request
.
target_branch
)
end
def
squash
(
user
,
merge_request
)
def
squash
(
user
,
merge_request
)
raw
.
squash
(
user
,
merge_request
.
id
,
branch:
merge_request
.
target_branch
,
raw
.
squash
(
user
,
merge_request
.
id
,
branch:
merge_request
.
target_branch
,
start_sha:
merge_request
.
diff_start_sha
,
start_sha:
merge_request
.
diff_start_sha
,
...
...
ee/app/models/license.rb
View file @
3ae31798
...
@@ -19,7 +19,6 @@ class License < ActiveRecord::Base
...
@@ -19,7 +19,6 @@ class License < ActiveRecord::Base
jenkins_integration
jenkins_integration
ldap_group_sync
ldap_group_sync
merge_request_approvers
merge_request_approvers
merge_request_rebase
merge_request_squash
merge_request_squash
multiple_ldap_servers
multiple_ldap_servers
multiple_issue_assignees
multiple_issue_assignees
...
@@ -79,7 +78,6 @@ class License < ActiveRecord::Base
...
@@ -79,7 +78,6 @@ class License < ActiveRecord::Base
issue_weights
issue_weights
jenkins_integration
jenkins_integration
merge_request_approvers
merge_request_approvers
merge_request_rebase
merge_request_squash
merge_request_squash
multiple_issue_assignees
multiple_issue_assignees
multiple_issue_boards
multiple_issue_boards
...
...
ee/app/services/merge_requests/rebase_service.rb
deleted
100644 → 0
View file @
71280599
module
MergeRequests
class
RebaseService
<
MergeRequests
::
WorkingCopyBaseService
def
execute
(
merge_request
)
@merge_request
=
merge_request
if
rebase
success
else
error
(
'Failed to rebase. Should be done manually'
)
end
end
def
rebase
if
merge_request
.
rebase_in_progress?
log_error
(
'Rebase task canceled: Another rebase is already in progress'
,
save_message_on_model:
true
)
return
false
end
rebase_sha
=
repository
.
rebase
(
current_user
,
merge_request
)
merge_request
.
update_attributes
(
rebase_commit_sha:
rebase_sha
)
true
rescue
=>
e
log_error
(
'Failed to rebase branch:'
)
log_error
(
e
.
message
,
save_message_on_model:
true
)
false
end
end
end
ee/app/services/merge_requests/working_copy_base_service.rb
deleted
100644 → 0
View file @
71280599
module
MergeRequests
class
WorkingCopyBaseService
<
MergeRequests
::
BaseService
attr_reader
:merge_request
def
source_project
@source_project
||=
merge_request
.
source_project
end
def
target_project
@target_project
||=
merge_request
.
target_project
end
def
log_error
(
message
,
save_message_on_model:
false
)
Gitlab
::
GitLogger
.
error
(
"
#{
self
.
class
.
name
}
error (
#{
merge_request
.
to_reference
(
full:
true
)
}
):
#{
message
}
"
)
merge_request
.
update
(
merge_error:
message
)
if
save_message_on_model
end
# Don't try to print expensive instance variables.
def
inspect
"#<
#{
self
.
class
}
#{
merge_request
.
to_reference
(
full:
true
)
}
>"
end
end
end
ee/app/views/projects/ee/_merge_request_fast_forward_settings.html.haml
deleted
100644 → 0
View file @
71280599
-
form
=
local_assigns
.
fetch
(
:form
)
-
project
=
local_assigns
.
fetch
(
:project
)
.radio
=
label_tag
:project_merge_method_ff
do
=
form
.
radio_button
:merge_method
,
:ff
,
class:
"js-merge-method-radio"
%strong
Fast-forward merge
%br
%span
.descr
No merge commits are created and all merges are fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.
-
if
project
.
feature_available?
(
:merge_request_rebase
)
%br
%span
.descr
When fast-forward merge is not possible, the user is given the option to rebase.
ee/app/views/projects/ee/_merge_request_rebase_settings.html.haml
deleted
100644 → 0
View file @
71280599
-
form
=
local_assigns
.
fetch
(
:form
)
.radio
=
label_tag
:project_merge_method_rebase_merge
do
=
form
.
radio_button
:merge_method
,
:rebase_merge
,
class:
"js-merge-method-radio"
%strong
Merge commit with semi-linear history
%br
%span
.descr
A merge commit is created for every merge, but merging is only allowed if fast-forward merge is possible.
This way you could make sure that if this merge request would build, after merging to target branch it would also build.
%br
%span
.descr
When fast-forward merge is not possible, the user is given the option to rebase.
ee/app/views/projects/ee/_merge_request_settings.html.haml
View file @
3ae31798
...
@@ -11,9 +11,9 @@
...
@@ -11,9 +11,9 @@
%span
.descr
%span
.descr
A merge commit is created for every merge, and merging is allowed as long as there are no conflicts.
A merge commit is created for every merge, and merging is allowed as long as there are no conflicts.
=
render
'projects/
ee/
merge_request_rebase_settings'
,
form:
form
=
render
'projects/merge_request_rebase_settings'
,
form:
form
=
render
'projects/
ee/
merge_request_fast_forward_settings'
,
project:
@project
,
form:
form
=
render
'projects/merge_request_fast_forward_settings'
,
project:
@project
,
form:
form
-
if
@project
.
feature_available?
(
:issuable_default_templates
)
-
if
@project
.
feature_available?
(
:issuable_default_templates
)
...
...
ee/app/workers/rebase_worker.rb
deleted
100644 → 0
View file @
71280599
class
RebaseWorker
include
ApplicationWorker
def
perform
(
merge_request_id
,
current_user_id
)
current_user
=
User
.
find
(
current_user_id
)
merge_request
=
MergeRequest
.
find
(
merge_request_id
)
MergeRequests
::
RebaseService
.
new
(
merge_request
.
source_project
,
current_user
)
.
execute
(
merge_request
)
end
end
spec/ee/spec/controllers/projects/merge_requests_controller_spec.rb
View file @
3ae31798
...
@@ -367,16 +367,6 @@ describe Projects::MergeRequestsController do
...
@@ -367,16 +367,6 @@ describe Projects::MergeRequestsController do
expect
(
RebaseWorker
).
to
receive
(
:perform_async
).
with
(
merge_request
.
id
,
user
.
id
)
expect
(
RebaseWorker
).
to
receive
(
:perform_async
).
with
(
merge_request
.
id
,
user
.
id
)
end
end
context
'successfully'
do
it
'enqeues a RebaseWorker'
do
expect_rebase_worker_for
(
viewer
)
post_rebase
expect
(
response
.
status
).
to
eq
(
200
)
end
end
context
'approvals pending'
do
context
'approvals pending'
do
let
(
:project
)
{
create
(
:project
,
:repository
,
approvals_before_merge:
1
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
approvals_before_merge:
1
)
}
...
@@ -399,43 +389,6 @@ describe Projects::MergeRequestsController do
...
@@ -399,43 +389,6 @@ describe Projects::MergeRequestsController do
end
end
it_behaves_like
'approvals'
it_behaves_like
'approvals'
context
'user cannot push to source branch'
do
it
'returns 404'
do
expect_rebase_worker_for
(
viewer
).
never
post_rebase
expect
(
response
.
status
).
to
eq
(
404
)
end
end
context
'user can push to source branch'
do
before
do
project
.
add_reporter
(
fork_owner
)
sign_in
(
fork_owner
)
end
it
'returns 200'
do
expect_rebase_worker_for
(
fork_owner
)
post_rebase
expect
(
response
.
status
).
to
eq
(
200
)
end
end
end
context
'rebase unavailable in license'
do
it
'returns 404'
do
stub_licensed_features
(
merge_request_rebase:
false
)
expect_rebase_worker_for
(
viewer
).
never
post_rebase
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
end
end
end
end
spec/ee/spec/models/ee/merge_request_spec.rb
View file @
3ae31798
...
@@ -13,66 +13,6 @@ describe MergeRequest do
...
@@ -13,66 +13,6 @@ describe MergeRequest do
it
{
is_expected
.
to
have_many
(
:approver_groups
).
dependent
(
:delete_all
)
}
it
{
is_expected
.
to
have_many
(
:approver_groups
).
dependent
(
:delete_all
)
}
end
end
describe
'#should_be_rebased?'
do
subject
{
merge_request
.
should_be_rebased?
}
context
'project forbids rebase'
do
it
{
is_expected
.
to
be_falsy
}
end
context
'project allows rebase'
do
let
(
:project
)
{
create
(
:project
,
:repository
,
merge_requests_rebase_enabled:
true
)
}
it
'returns false when the project feature is unavailable'
do
expect
(
merge_request
.
target_project
).
to
receive
(
:feature_available?
).
with
(
:merge_request_rebase
).
at_least
(
:once
).
and_return
(
false
)
is_expected
.
to
be_falsy
end
it
'returns true when the project feature is available'
do
expect
(
merge_request
.
target_project
).
to
receive
(
:feature_available?
).
with
(
:merge_request_rebase
).
at_least
(
:once
).
and_return
(
true
)
is_expected
.
to
be_truthy
end
end
end
describe
'#rebase_in_progress?'
do
# Create merge request and project before we stub file calls
before
do
subject
end
it
'returns true when there is a current rebase directory'
do
allow
(
File
).
to
receive
(
:exist?
).
and_return
(
true
)
allow
(
File
).
to
receive
(
:mtime
).
and_return
(
Time
.
now
)
expect
(
subject
.
rebase_in_progress?
).
to
be_truthy
end
it
'returns false when there is no rebase directory'
do
allow
(
File
).
to
receive
(
:exist?
).
and_return
(
false
)
expect
(
subject
.
rebase_in_progress?
).
to
be_falsey
end
it
'returns false when the rebase directory has expired'
do
allow
(
File
).
to
receive
(
:exist?
).
and_return
(
true
)
allow
(
File
).
to
receive
(
:mtime
).
and_return
(
20
.
minutes
.
ago
)
expect
(
subject
.
rebase_in_progress?
).
to
be_falsey
end
it
'returns false when the source project has been removed'
do
allow
(
subject
).
to
receive
(
:source_project
).
and_return
(
nil
)
allow
(
File
).
to
receive
(
:exist?
).
and_return
(
true
)
allow
(
File
).
to
receive
(
:mtime
).
and_return
(
Time
.
now
)
expect
(
File
).
not_to
have_received
(
:exist?
)
expect
(
subject
.
rebase_in_progress?
).
to
be_falsey
end
end
describe
'#squash_in_progress?'
do
describe
'#squash_in_progress?'
do
# Create merge request and project before we stub file calls
# Create merge request and project before we stub file calls
before
do
before
do
...
...
spec/ee/spec/models/ee/project_spec.rb
View file @
3ae31798
...
@@ -1066,31 +1066,6 @@ describe Project do
...
@@ -1066,31 +1066,6 @@ describe Project do
end
end
end
end
describe
'#merge_method'
do
where
(
:ff
,
:rebase
,
:rebase_licensed
,
:method
)
do
true
|
true
|
true
|
:ff
true
|
true
|
false
|
:ff
true
|
false
|
true
|
:ff
true
|
false
|
false
|
:ff
false
|
true
|
true
|
:rebase_merge
false
|
true
|
false
|
:merge
false
|
false
|
true
|
:merge
false
|
false
|
false
|
:merge
end
with_them
do
let
(
:project
)
{
build
(
:project
,
merge_requests_rebase_enabled:
rebase
,
merge_requests_ff_only_enabled:
ff
)
}
subject
{
project
.
merge_method
}
before
do
stub_licensed_features
(
merge_request_rebase:
rebase_licensed
)
end
it
{
is_expected
.
to
eq
(
method
)
}
end
end
describe
'#rename_repo'
do
describe
'#rename_repo'
do
context
'when running on a primary node'
do
context
'when running on a primary node'
do
set
(
:primary
)
{
create
(
:geo_node
,
:primary
)
}
set
(
:primary
)
{
create
(
:geo_node
,
:primary
)
}
...
...
spec/models/project_spec.rb
View file @
3ae31798
...
@@ -456,14 +456,21 @@ describe Project do
...
@@ -456,14 +456,21 @@ describe Project do
end
end
describe
'#merge_method'
do
describe
'#merge_method'
do
it
'returns "ff" merge_method when ff is enabled'
do
using
RSpec
::
Parameterized
::
TableSyntax
project
=
build
(
:project
,
merge_requests_ff_only_enabled:
true
)
expect
(
project
.
merge_method
).
to
be
:ff
where
(
:ff
,
:rebase
,
:method
)
do
true
|
true
|
:ff
true
|
false
|
:ff
false
|
true
|
:rebase_merge
false
|
false
|
:merge
end
end
it
'returns "merge" merge_method when ff is disabled'
do
with_them
do
project
=
build
(
:project
,
merge_requests_ff_only_enabled:
false
)
let
(
:project
)
{
build
(
:project
,
merge_requests_rebase_enabled:
rebase
,
merge_requests_ff_only_enabled:
ff
)
}
expect
(
project
.
merge_method
).
to
be
:merge
subject
{
project
.
merge_method
}
it
{
is_expected
.
to
eq
(
method
)
}
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