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
721b7573
Commit
721b7573
authored
Sep 04, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take the next type into consideration
parent
dc7554d0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+2
-2
app/views/projects/commits/_parallel_view.html.haml
app/views/projects/commits/_parallel_view.html.haml
+3
-2
lib/gitlab/diff_parser.rb
lib/gitlab/diff_parser.rb
+2
-1
No files found.
app/helpers/commits_helper.rb
View file @
721b7573
...
...
@@ -25,8 +25,8 @@ module CommitsHelper
def
side_diff_line
(
diff
,
index
)
Gitlab
::
DiffParser
.
new
(
diff
.
diff
.
lines
.
to_a
,
diff
.
new_path
)
.
each
do
|
full_line
,
type
,
line_code
,
line_new
,
line_old
,
raw_line
,
next_line
|
yield
(
full_line
,
type
,
line_code
,
line_new
,
line_old
,
raw_line
,
next_line
)
.
each
do
|
full_line
,
type
,
line_code
,
line_new
,
line_old
,
raw_line
,
next_
type
,
next_
line
|
yield
(
full_line
,
type
,
line_code
,
line_new
,
line_old
,
raw_line
,
next_
type
,
next_
line
)
end
end
...
...
app/views/projects/commits/_parallel_view.html.haml
View file @
721b7573
/ Side-by-side diff view
%div
.text-file
%table
-
side_diff_line
(
diff
,
index
)
do
|
line
,
type
,
line_code
,
line_new
,
line_old
,
raw_line
,
next_line
|
-
side_diff_line
(
diff
,
index
)
do
|
line
,
type
,
line_code
,
line_new
,
line_old
,
raw_line
,
next_
type
,
next_
line
|
%tr
.line_holder.parallel
{
id:
line_code
}
-
if
type
==
"match"
=
render
"projects/commits/diffs/match_line_parallel"
,
{
line:
line
,
...
...
@@ -25,7 +25,8 @@
%td
.new_line
{
class:
"#{type}"
,
data:
{
linenumber:
line_new
}}
=
link_to
raw
(
line_new
)
,
"#
#{
line_code
}
"
,
id:
line_code
-
if
type
==
'old'
%td
.line_content.parallel
{
class:
"noteable_line new #{line_code}"
,
"line_code"
=>
line_code
}=
raw
next_line
-
content
=
next_type
==
'new'
?
next_line
:
" "
%td
.line_content.parallel
{
class:
"noteable_line new #{line_code}"
,
"line_code"
=>
line_code
}=
raw
content
-
else
%td
.line_content.parallel
{
class:
"#{type}"
}=
raw
line
...
...
lib/gitlab/diff_parser.rb
View file @
721b7573
...
...
@@ -38,8 +38,9 @@ module Gitlab
next
else
type
=
identification_type
(
line
)
next_type
=
identification_type
(
next_line
)
line_code
=
generate_line_code
(
new_path
,
line_new
,
line_old
)
yield
(
full_line
,
type
,
line_code
,
line_new
,
line_old
,
raw_line
,
next_line
)
yield
(
full_line
,
type
,
line_code
,
line_new
,
line_old
,
raw_line
,
next_
type
,
next_
line
)
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