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
1674970a
Commit
1674970a
authored
Jan 13, 2018
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ce-to-ee-2018-01-12' into 'master'
CE upstream - Friday See merge request gitlab-org/gitlab-ee!4060
parents
5f99ecc9
0e2f4f55
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
106 additions
and
13 deletions
+106
-13
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+0
-7
app/models/commit.rb
app/models/commit.rb
+3
-2
app/models/merge_request.rb
app/models/merge_request.rb
+10
-1
changelogs/unreleased/41807-15665-consistently-502s-because-it-fetches-every-commit.yml
...665-consistently-502s-because-it-fetches-every-commit.yml
+6
-0
ee/app/assets/stylesheets/pages/projects.scss
ee/app/assets/stylesheets/pages/projects.scss
+7
-0
spec/models/commit_range_spec.rb
spec/models/commit_range_spec.rb
+3
-3
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+77
-0
No files found.
app/assets/stylesheets/pages/projects.scss
View file @
1674970a
...
...
@@ -907,13 +907,6 @@ a.allowed-to-push {
}
}
.protected-branch-push-access-list
,
.protected-branch-merge-access-list
{
a
{
color
:
$white-light
;
}
}
.protected-branches-list
,
.protected-tags-list
{
margin-bottom
:
30px
;
...
...
app/models/commit.rb
View file @
1674970a
...
...
@@ -346,10 +346,11 @@ class Commit
@merged_merge_request_hash
[
current_user
]
end
def
has_been_reverted?
(
current_user
,
note
able
=
self
)
def
has_been_reverted?
(
current_user
,
note
s_association
=
nil
)
ext
=
all_references
(
current_user
)
notes_association
||=
notes_with_associations
note
able
.
notes_with_associations
.
system
.
each
do
|
note
|
note
s_association
.
system
.
each
do
|
note
|
note
.
all_references
(
current_user
,
extractor:
ext
)
end
...
...
app/models/merge_request.rb
View file @
1674970a
...
...
@@ -1011,7 +1011,16 @@ class MergeRequest < ActiveRecord::Base
end
def
can_be_reverted?
(
current_user
)
merge_commit
&&
!
merge_commit
.
has_been_reverted?
(
current_user
,
self
)
return
false
unless
merge_commit
merged_at
=
metrics
&
.
merged_at
notes_association
=
notes_with_associations
if
merged_at
notes_association
=
notes_association
.
where
(
'created_at > ?'
,
merged_at
)
end
!
merge_commit
.
has_been_reverted?
(
current_user
,
notes_association
)
end
def
can_be_cherry_picked?
...
...
changelogs/unreleased/41807-15665-consistently-502s-because-it-fetches-every-commit.yml
0 → 100644
View file @
1674970a
---
title
:
Speed up loading merged merge requests when they contained a lot of commits
before merging
merge_request
:
16320
author
:
type
:
performance
ee/app/assets/stylesheets/pages/projects.scss
View file @
1674970a
.protected-branch-push-access-list
,
.protected-branch-merge-access-list
{
a
{
color
:
$white-light
;
}
}
.project-mirror-settings
{
.fingerprint-verified
{
color
:
$green-500
;
...
...
spec/models/commit_range_spec.rb
View file @
1674970a
...
...
@@ -151,11 +151,11 @@ describe CommitRange do
.
with
(
commit1
,
user
)
.
and_return
(
true
)
expect
(
commit1
.
has_been_reverted?
(
user
,
issue
)).
to
eq
(
true
)
expect
(
commit1
.
has_been_reverted?
(
user
,
issue
.
notes_with_associations
)).
to
eq
(
true
)
end
it
'returns false
a
commit has not been reverted'
do
expect
(
commit1
.
has_been_reverted?
(
user
,
issue
)).
to
eq
(
false
)
it
'returns false
if the
commit has not been reverted'
do
expect
(
commit1
.
has_been_reverted?
(
user
,
issue
.
notes_with_associations
)).
to
eq
(
false
)
end
end
end
spec/models/merge_request_spec.rb
View file @
1674970a
...
...
@@ -1272,6 +1272,83 @@ describe MergeRequest do
end
end
describe
'#can_be_reverted?'
do
context
'when there is no merged_at for the MR'
do
before
do
subject
.
metrics
.
update!
(
merged_at:
nil
)
end
it
'returns false'
do
expect
(
subject
.
can_be_reverted?
(
nil
)).
to
be_falsey
end
end
context
'when there is no merge_commit for the MR'
do
before
do
subject
.
metrics
.
update!
(
merged_at:
Time
.
now
.
utc
)
end
it
'returns false'
do
expect
(
subject
.
can_be_reverted?
(
nil
)).
to
be_falsey
end
end
context
'when the MR has been merged'
do
before
do
MergeRequests
::
MergeService
.
new
(
subject
.
target_project
,
subject
.
author
)
.
execute
(
subject
)
end
context
'when there is no revert commit'
do
it
'returns true'
do
expect
(
subject
.
can_be_reverted?
(
nil
)).
to
be_truthy
end
end
context
'when there is a revert commit'
do
let
(
:current_user
)
{
subject
.
author
}
let
(
:branch
)
{
subject
.
target_branch
}
let
(
:project
)
{
subject
.
target_project
}
let
(
:revert_commit_id
)
do
params
=
{
commit:
subject
.
merge_commit
,
branch_name:
branch
,
start_branch:
branch
}
Commits
::
RevertService
.
new
(
project
,
current_user
,
params
).
execute
[
:result
]
end
before
do
project
.
add_master
(
current_user
)
ProcessCommitWorker
.
new
.
perform
(
project
.
id
,
current_user
.
id
,
project
.
commit
(
revert_commit_id
).
to_hash
,
project
.
default_branch
==
branch
)
end
context
'when the revert commit is mentioned in a note after the MR was merged'
do
it
'returns false'
do
expect
(
subject
.
can_be_reverted?
(
current_user
)).
to
be_falsey
end
end
context
'when the revert commit is mentioned in a note before the MR was merged'
do
before
do
subject
.
notes
.
last
.
update!
(
created_at:
subject
.
metrics
.
merged_at
-
1
.
second
)
end
it
'returns true'
do
expect
(
subject
.
can_be_reverted?
(
current_user
)).
to
be_truthy
end
end
end
end
end
describe
'#participants'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
...
...
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