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
b3834bc9
Commit
b3834bc9
authored
Nov 23, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove MergeRequest#to_raw and replace it with #to_diff and #to_patch
parent
2b1afa0e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
merge_request.rb
app/models/merge_request.rb
+14
-12
No files found.
app/models/merge_request.rb
View file @
b3834bc9
...
...
@@ -202,20 +202,22 @@ class MergeRequest < ActiveRecord::Base
false
end
def
to_raw
FileUtils
.
mkdir_p
(
Rails
.
root
.
join
(
"tmp"
,
"patches"
))
patch_path
=
Rails
.
root
.
join
(
"tmp"
,
"patches"
,
"merge_request_
#{
self
.
id
}
.patch"
)
from
=
commits
.
last
.
id
to
=
source_branch
project
.
repo
.
git
.
run
(
''
,
"format-patch"
,
" >
#{
patch_path
.
to_s
}
"
,
{},
[
"
#{
from
}
..
#{
to
}
"
,
"--stdout"
])
patch_path
end
def
mr_and_commit_notes
commit_ids
=
commits
.
map
(
&
:
id
)
Note
.
where
(
"(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND noteable_id IN (:commit_ids))"
,
mr_id:
id
,
commit_ids:
commit_ids
)
end
# Returns the raw diff for this merge request
#
# see "git diff"
def
to_diff
project
.
repo
.
git
.
native
(
:diff
,
{
timeout:
30
,
raise:
true
},
"
#{
target_branch
}
...
#{
source_branch
}
"
)
end
# Returns the commit as a series of email patches.
#
# see "git format-patch"
def
to_patch
project
.
repo
.
git
.
format_patch
({
timeout:
30
,
raise:
true
,
stdout:
true
},
"
#{
target_branch
}
..
#{
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