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
Jérome Perrin
gitlab-ce
Commits
997a12c9
Commit
997a12c9
authored
May 11, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sha-mismatch state to mr-widget to prevent accidental merges when branch unknowingly changes
parent
e7b53dd6
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
0 deletions
+24
-0
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_sha_mismatch.js
...equest_widget/components/states/mr_widget_sha_mismatch.js
+16
-0
app/assets/javascripts/vue_merge_request_widget/dependencies.js
...sets/javascripts/vue_merge_request_widget/dependencies.js
+1
-0
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
...javascripts/vue_merge_request_widget/mr_widget_options.js
+2
-0
app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js
...ascripts/vue_merge_request_widget/stores/get_state_key.js
+2
-0
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+2
-0
app/assets/javascripts/vue_merge_request_widget/stores/state_maps.js
...javascripts/vue_merge_request_widget/stores/state_maps.js
+1
-0
No files found.
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_sha_mismatch.js
0 → 100644
View file @
997a12c9
export
default
{
name
:
'
MRWidgetSHAMismatch
'
,
template
:
`
<div class="mr-widget-body">
<button
type="button"
class="btn btn-success btn-small"
disabled="true">
Merge
</button>
<span class="bold">
The source branch HEAD has recently changed. Please reload the page and review the changes before merging.
</span>
</div>
`
,
};
app/assets/javascripts/vue_merge_request_widget/dependencies.js
View file @
997a12c9
...
...
@@ -27,6 +27,7 @@ export { default as NothingToMergeState } from './components/states/mr_widget_no
export
{
default
as
MissingBranchState
}
from
'
./components/states/mr_widget_missing_branch
'
;
export
{
default
as
NotAllowedState
}
from
'
./components/states/mr_widget_not_allowed
'
;
export
{
default
as
ReadyToMergeState
}
from
'
./components/states/mr_widget_ready_to_merge
'
;
export
{
default
as
SHAMismatchState
}
from
'
./components/states/mr_widget_sha_mismatch
'
;
export
{
default
as
UnresolvedDiscussionsState
}
from
'
./components/states/mr_widget_unresolved_discussions
'
;
export
{
default
as
PipelineBlockedState
}
from
'
./components/states/mr_widget_pipeline_blocked
'
;
export
{
default
as
PipelineFailedState
}
from
'
./components/states/mr_widget_pipeline_failed
'
;
...
...
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
View file @
997a12c9
...
...
@@ -16,6 +16,7 @@ import {
MissingBranchState
,
NotAllowedState
,
ReadyToMergeState
,
SHAMismatchState
,
UnresolvedDiscussionsState
,
PipelineBlockedState
,
PipelineFailedState
,
...
...
@@ -203,6 +204,7 @@ export default {
'
mr-widget-not-allowed
'
:
NotAllowedState
,
'
mr-widget-missing-branch
'
:
MissingBranchState
,
'
mr-widget-ready-to-merge
'
:
ReadyToMergeState
,
'
mr-widget-sha-mismatch
'
:
SHAMismatchState
,
'
mr-widget-squash-before-merge
'
:
SquashBeforeMerge
,
'
mr-widget-checking
'
:
CheckingState
,
'
mr-widget-unresolved-discussions
'
:
UnresolvedDiscussionsState
,
...
...
app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js
View file @
997a12c9
...
...
@@ -21,6 +21,8 @@ export default function deviseState(data) {
return
'
unresolvedDiscussions
'
;
}
else
if
(
this
.
isPipelineBlocked
)
{
return
'
pipelineBlocked
'
;
}
else
if
(
this
.
hasSHAChanged
)
{
return
'
shaMismatch
'
;
}
else
if
(
this
.
canBeMerged
)
{
return
'
readyToMerge
'
;
}
...
...
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
997a12c9
...
...
@@ -4,6 +4,7 @@ import { getStateKey } from '../dependencies';
export
default
class
MergeRequestStore
{
constructor
(
data
)
{
this
.
startingSha
=
data
.
diff_head_sha
;
this
.
setData
(
data
);
}
...
...
@@ -67,6 +68,7 @@ export default class MergeRequestStore {
this
.
canMerge
=
!!
data
.
merge_path
;
this
.
canCreateIssue
=
currentUser
.
can_create_issue
||
false
;
this
.
canCancelAutomaticMerge
=
!!
data
.
cancel_merge_when_pipeline_succeeds_path
;
this
.
hasSHAChanged
=
this
.
sha
!==
this
.
startingSha
;
this
.
canBeMerged
=
data
.
can_be_merged
||
false
;
// Cherry-pick and Revert actions related
...
...
app/assets/javascripts/vue_merge_request_widget/stores/state_maps.js
View file @
997a12c9
...
...
@@ -16,6 +16,7 @@ const stateToComponentMap = {
mergeWhenPipelineSucceeds
:
'
mr-widget-merge-when-pipeline-succeeds
'
,
failedToMerge
:
'
mr-widget-failed-to-merge
'
,
autoMergeFailed
:
'
mr-widget-auto-merge-failed
'
,
shaMismatch
:
'
mr-widget-sha-mismatch
'
,
};
const
statesToShowHelpWidget
=
[
...
...
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