BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9ec4c2d2
Commit
9ec4c2d2
authored
Aug 21, 2012
by
Sytse Sijbrandij
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show only the commits that are newer in the merge request.
parent
64f3682f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
merge_request.rb
app/models/merge_request.rb
+5
-2
No files found.
app/models/merge_request.rb
View file @
9ec4c2d2
...
...
@@ -88,8 +88,11 @@ class MergeRequest < ActiveRecord::Base
end
def
unmerged_diffs
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
)
rescue
[]
# Only show what is new in the source branch compared to the target branch, not the other way around.
# The linex below with merge_base is equivalent to diff with three dots (git diff branch1...branch2)
# From the git documentation: "git diff A...B" is equivalent to "git diff $(git-merge-base A B) B"
common_commit
=
project
.
repo
.
git
.
native
(:
merge_base
,
{},
[
target_branch
,
source_branch
]).
strip
diffs
=
project
.
repo
.
diff
(
common_commit
,
source_branch
)
end
def
last_commit
...
...
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