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
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
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
app/models/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
...
@@ -88,8 +88,11 @@ class MergeRequest < ActiveRecord::Base
end
end
def
unmerged_diffs
def
unmerged_diffs
commits
=
project
.
repo
.
commits_between
(
target_branch
,
source_branch
).
map
{
|
c
|
Commit
.
new
(
c
)}
# Only show what is new in the source branch compared to the target branch, not the other way around.
diffs
=
project
.
repo
.
diff
(
commits
.
first
.
prev_commit
.
id
,
commits
.
last
.
id
)
rescue
[]
# 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
end
def
last_commit
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