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
79b64ef4
Commit
79b64ef4
authored
Nov 29, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed merge request diff
parent
958497fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
app/controllers/merge_requests_controller.rb
app/controllers/merge_requests_controller.rb
+3
-2
app/models/commit.rb
app/models/commit.rb
+4
-0
app/models/merge_request.rb
app/models/merge_request.rb
+10
-0
No files found.
app/controllers/merge_requests_controller.rb
View file @
79b64ef4
...
...
@@ -34,8 +34,9 @@ class MergeRequestsController < ApplicationController
end
def
diffs
@commit
=
@project
.
commit
(
@merge_request
.
source_branch
)
@diffs
=
@project
.
repo
.
diff
(
@merge_request
.
target_branch
,
@merge_request
.
source_branch
)
@diffs
=
@merge_request
.
diffs
@commit
=
@merge_request
.
last_commit
render
:template
=>
"merge_requests/_diffs"
,
:layout
=>
false
end
...
...
app/models/commit.rb
View file @
79b64ef4
...
...
@@ -36,4 +36,8 @@ class Commit
def
author_name
encode
(
author
.
name
)
end
def
prev_commit
parents
.
first
end
end
app/models/merge_request.rb
View file @
79b64ef4
...
...
@@ -33,4 +33,14 @@ class MergeRequest < ActiveRecord::Base
def
new?
today?
&&
created_at
==
updated_at
end
def
diffs
commit
=
project
.
commit
(
source_branch
)
commits
=
project
.
repo
.
commits_between
(
target_branch
,
source_branch
).
map
{
|
c
|
Commit
.
new
(
c
)}
diffs
=
project
.
repo
.
diff
(
commits
.
first
.
prev_commit
.
id
,
commits
.
last
.
id
)
end
def
last_commit
project
.
commit
(
source_branch
)
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