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
Kazuhiko Shiozaki
gitlab-ce
Commits
7ab587a4
Commit
7ab587a4
authored
Aug 23, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1263 from dosire/merge_base_for_merge_request
Show only the commits that are newer in the merge request.
parents
a94b2d1c
9ec4c2d2
Changes
1
Hide 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 @
7ab587a4
...
@@ -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