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
6041fbce
Commit
6041fbce
authored
Jul 13, 2016
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented conflict side selection.
parent
c277681e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
21 deletions
+65
-21
app/assets/javascripts/merge_conflict_resolver.js.coffee
app/assets/javascripts/merge_conflict_resolver.js.coffee
+41
-13
app/views/projects/merge_requests/show/_conflicts.html.haml
app/views/projects/merge_requests/show/_conflicts.html.haml
+24
-8
No files found.
app/assets/javascripts/merge_conflict_resolver.js.coffee
View file @
6041fbce
...
@@ -4,10 +4,14 @@ class window.MergeConflictResolver extends Vue
...
@@ -4,10 +4,14 @@ class window.MergeConflictResolver extends Vue
constructor
:
(
options
=
{})
->
constructor
:
(
options
=
{})
->
options
.
el
=
'#conflicts'
options
.
el
=
'#conflicts'
options
.
data
=
@
getInitialData
()
options
.
data
=
@
getInitialData
()
options
.
created
=
->
@
fetchData
()
options
.
name
=
'MergeConflictResolver'
options
.
name
=
'MergeConflictResolver'
options
.
created
=
->
@
fetchData
()
options
.
computed
=
conflictsCount
:
->
@
getConflictsCount
()
resolvedCount
:
->
@
getResolvedCount
()
allResolved
:
->
@
isAllResolved
()
super
options
super
options
...
@@ -43,7 +47,7 @@ class window.MergeConflictResolver extends Vue
...
@@ -43,7 +47,7 @@ class window.MergeConflictResolver extends Vue
handleSelected
:
(
sectionId
,
selection
)
->
handleSelected
:
(
sectionId
,
selection
)
->
console
.
log
sectionId
,
selection
@
resolutionData
[
sectionId
]
=
selection
decorateData
:
(
data
)
->
decorateData
:
(
data
)
->
...
@@ -51,6 +55,8 @@ class window.MergeConflictResolver extends Vue
...
@@ -51,6 +55,8 @@ class window.MergeConflictResolver extends Vue
headHeaderText
=
'HEAD//our changes'
headHeaderText
=
'HEAD//our changes'
originHeaderText
=
'origin//their changes'
originHeaderText
=
'origin//their changes'
@
updateResolutionsData
data
for
file
in
data
.
files
for
file
in
data
.
files
file
.
parallelLines
=
{
left
:
[],
right
:
[]
}
file
.
parallelLines
=
{
left
:
[],
right
:
[]
}
file
.
inlineLines
=
[]
file
.
inlineLines
=
[]
...
@@ -61,10 +67,10 @@ class window.MergeConflictResolver extends Vue
...
@@ -61,10 +67,10 @@ class window.MergeConflictResolver extends Vue
{
conflict
,
lines
,
id
}
=
section
{
conflict
,
lines
,
id
}
=
section
if
conflict
if
conflict
file
.
parallelLines
.
left
.
push
{
isHeader
:
yes
,
id
,
text
:
headHeaderText
,
cssClass
:
'head'
}
file
.
parallelLines
.
left
.
push
{
isHeader
:
yes
,
id
,
text
:
headHeaderText
,
cssClass
:
'head'
,
section
:
'head'
}
file
.
parallelLines
.
right
.
push
{
isHeader
:
yes
,
id
,
text
:
originHeaderText
,
cssClass
:
'origin'
}
file
.
parallelLines
.
right
.
push
{
isHeader
:
yes
,
id
,
text
:
originHeaderText
,
cssClass
:
'origin'
,
section
:
'origin'
}
file
.
inlineLines
.
push
{
isHeader
:
yes
,
id
,
text
:
headHeaderText
,
type
:
'old'
,
cssClass
:
'head'
}
file
.
inlineLines
.
push
{
isHeader
:
yes
,
id
,
text
:
headHeaderText
,
type
:
'old'
,
cssClass
:
'head'
,
section
:
'head'
}
for
line
in
lines
for
line
in
lines
if
line
.
type
in
[
'new'
,
'old'
]
and
currentLineType
isnt
line
.
type
if
line
.
type
in
[
'new'
,
'old'
]
and
currentLineType
isnt
line
.
type
...
@@ -90,18 +96,40 @@ class window.MergeConflictResolver extends Vue
...
@@ -90,18 +96,40 @@ class window.MergeConflictResolver extends Vue
file
.
parallelLines
.
right
.
push
{
lineType
:
'context'
,
lineNumber
:
line
.
new_line
,
text
:
line
.
text
}
file
.
parallelLines
.
right
.
push
{
lineType
:
'context'
,
lineNumber
:
line
.
new_line
,
text
:
line
.
text
}
if
conflict
if
conflict
file
.
inlineLines
.
push
{
isHeader
:
yes
,
id
,
type
:
'new'
,
text
:
originHeaderText
,
cssClass
:
'origin'
}
file
.
inlineLines
.
push
{
isHeader
:
yes
,
id
,
type
:
'new'
,
text
:
originHeaderText
,
cssClass
:
'origin'
,
section
:
'origin'
}
return
data
return
data
getConflictsCount
:
->
return
Object
.
keys
(
@
resolutionData
).
length
getResolvedCount
:
->
count
=
0
count
++
for
id
,
resolution
of
@
resolutionData
when
resolution
return
count
isAllResolved
:
->
return
@
resolvedCount
is
@
conflictsCount
updateResolutionsData
:
(
data
)
->
for
file
in
data
.
files
for
section
in
file
.
sections
when
section
.
conflict
@
$set
"resolutionData.
#{
section
.
id
}
"
,
no
getInitialData
:
->
getInitialData
:
->
diffViewType
=
$
.
cookie
'diff_view'
diffViewType
=
$
.
cookie
'diff_view'
return
{
return
{
isLoading
:
yes
isLoading
:
yes
diffView
:
diffViewType
isParallel
:
diffViewType
is
'parallel'
conflictsData
:
{}
diffView
:
diffViewType
isParallel
:
diffViewType
is
'parallel'
conflictsData
:
{}
resolutionData
:
{}
}
}
app/views/projects/merge_requests/show/_conflicts.html.haml
View file @
6041fbce
...
@@ -22,9 +22,8 @@
...
@@ -22,9 +22,8 @@
into
into
%strong
{{conflictsData.target_branch}}
%strong
{{conflictsData.target_branch}}
.files-wrapper
{
"v-if"
=>
"!isLoading"
}
.files-wrapper
{
"v-if"
=>
"!isLoading"
}
.files
{
{
"v-if"
=>
"isParallel"
}
}
.files
{
"v-if"
=>
"isParallel"
}
.diff-file.file-holder.conflict.unresolved.parallel-view
{
"v-for"
=>
"file in conflictsData.files"
}
.diff-file.file-holder.conflict.unresolved.parallel-view
{
"v-for"
=>
"file in conflictsData.files"
}
.file-title
.file-title
%i
.fa.fa-ban
%i
.fa.fa-ban
...
@@ -42,16 +41,16 @@
...
@@ -42,16 +41,16 @@
%td
.diff-line-num.header
%td
.diff-line-num.header
%td
.line_content.header
%td
.line_content.header
%strong
{{line.text}}
%strong
{{line.text}}
%button
.btn
{
"@click"
=>
"handleSelected(line.id, line.lineType)"
}
Use this
/ FIXME: Don't use cssClass here
%button
.btn
{
"@click"
=>
"handleSelected(line.id, line.cssClass)"
}
Use this
%template
{
"v-if"
=>
"!line.isHeader"
}
%template
{
"v-if"
=>
"!line.isHeader"
}
%td
.diff-line-num.old_line
%td
.diff-line-num.old_line
{{line.lineNumber}}
{{line.lineNumber}}
%td
.line_content
%td
.line_content
{{line.text}}
{{{line.text}}}
.files
{
{
"v-if"
=>
"!isParallel"
}
}
.files
{
"v-if"
=>
"!isParallel"
}
.diff-file.file-holder.conflict.unresolved.inline-view
{
"v-for"
=>
"file in conflictsData.files"
}
.diff-file.file-holder.conflict.unresolved.inline-view
{
"v-for"
=>
"file in conflictsData.files"
}
.file-title
.file-title
%i
.fa.fa-ban
%i
.fa.fa-ban
...
@@ -77,5 +76,22 @@
...
@@ -77,5 +76,22 @@
%td
.diff-line-num.header
%td
.diff-line-num.header
%td
.diff-line-num.header
%td
.diff-line-num.header
%td
.line_content.header
%td
.line_content.header
%strong
{{line.text}}
%strong
{{{line.text}}}
%button
.btn
{
"@click"
=>
"handleSelected(line.id, line.type)"
}
Use this
/ FIXME: Don't use cssClass here
%button
.btn
{
"@click"
=>
"handleSelected(line.id, line.cssClass)"
}
Use this
.content-block.oneline-block.files-changed
%strong
.resolved-count
{{resolvedCount}}
of
%strong
.total-count
{{conflictsCount}}
conflicts have been resolved
.commit-message-container.form-group
.max-width-marker
%textarea
.form-control.js-commit-message
{
"placeholder"
=>
'Your commit message'
,
":disabled"
=>
"!allResolved"
}
%button
{
type:
'button'
,
class:
'btn btn-success js-submit-button'
,
":disabled"
=>
"!allResolved"
}
Commit conflict resolution
%button
{
type:
'button'
,
class:
'btn btn-cancel'
}
Cancel
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