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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
18a5bb05
Commit
18a5bb05
authored
Jun 20, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store diff head and start commit shas on MR diffs
parent
c66a7b0e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
7 deletions
+20
-7
app/models/merge_request_diff.rb
app/models/merge_request_diff.rb
+10
-7
db/migrate/20160508202603_add_head_commit_id_to_merge_request_diffs.rb
...160508202603_add_head_commit_id_to_merge_request_diffs.rb
+5
-0
db/migrate/20160516224534_add_start_commit_id_to_merge_request_diffs.rb
...60516224534_add_start_commit_id_to_merge_request_diffs.rb
+5
-0
No files found.
app/models/merge_request_diff.rb
View file @
18a5bb05
...
@@ -24,7 +24,7 @@ class MergeRequestDiff < ActiveRecord::Base
...
@@ -24,7 +24,7 @@ class MergeRequestDiff < ActiveRecord::Base
serialize
:st_diffs
serialize
:st_diffs
after_create
:reload_content
,
unless: :importing?
after_create
:reload_content
,
unless: :importing?
after_save
:keep_around_commit
after_save
:keep_around_commit
s
def
reload_content
def
reload_content
reload_commits
reload_commits
...
@@ -147,12 +147,13 @@ class MergeRequestDiff < ActiveRecord::Base
...
@@ -147,12 +147,13 @@ class MergeRequestDiff < ActiveRecord::Base
new_attributes
[
:st_diffs
]
=
new_diffs
new_attributes
[
:st_diffs
]
=
new_diffs
base_commit_sha
=
self
.
repository
.
merge_base
(
self
.
head
,
self
.
base
)
new_attributes
[
:start_commit_sha
]
=
self
.
target_branch_sha
new_attributes
[
:base_commit_sha
]
=
base_commit_sha
new_attributes
[
:head_commit_sha
]
=
self
.
source_branch_sha
new_attributes
[
:base_commit_sha
]
=
branch_base_sha
self
.
repository
.
keep_around
(
base_commit_sha
)
update_columns_serialized
(
new_attributes
)
update_columns_serialized
(
new_attributes
)
keep_around_commits
end
end
# Collect array of Git::Diff objects
# Collect array of Git::Diff objects
...
@@ -223,7 +224,9 @@ class MergeRequestDiff < ActiveRecord::Base
...
@@ -223,7 +224,9 @@ class MergeRequestDiff < ActiveRecord::Base
reload
reload
end
end
def
keep_around_commit
def
keep_around_commits
self
.
repository
.
keep_around
(
self
.
base_commit_sha
)
self
.
repository
.
keep_around
(
target_branch_sha
)
self
.
repository
.
keep_around
(
source_branch_sha
)
self
.
repository
.
keep_around
(
branch_base_sha
)
end
end
end
end
db/migrate/20160508202603_add_head_commit_id_to_merge_request_diffs.rb
0 → 100644
View file @
18a5bb05
class
AddHeadCommitIdToMergeRequestDiffs
<
ActiveRecord
::
Migration
def
change
add_column
:merge_request_diffs
,
:head_commit_sha
,
:string
end
end
db/migrate/20160516224534_add_start_commit_id_to_merge_request_diffs.rb
0 → 100644
View file @
18a5bb05
class
AddStartCommitIdToMergeRequestDiffs
<
ActiveRecord
::
Migration
def
change
add_column
:merge_request_diffs
,
:start_commit_sha
,
:string
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