Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
bccff6632db4
Commit
bccff663
authored
Feb 04, 2020
by
GitLab Bot
Browse files
Add latest changes from gitlab-org/gitlab@master
parent
12af3e15befd
Changes
79
Hide whitespace changes
Inline
Side-by-side
app/assets/javascripts/diffs/components/diff_stats.vue
View file @
bccff663
...
...
@@ -17,7 +17,7 @@
diffFilesLength
:
{
type
:
Number
,
required
:
false
,
default
:
0
,
default
:
null
,
},
},
computed
:
{
...
...
app/assets/javascripts/error_tracking/components/error_details.vue
View file @
bccff663
...
...
@@ -2,7 +2,15 @@
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
dateFormat
from
'
dateformat
'
;
import
createFlash
from
'
~/flash
'
;
import
{
GlButton
,
GlFormInput
,
GlLink
,
GlLoadingIcon
,
GlBadge
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlFormInput
,
GlLink
,
GlLoadingIcon
,
GlBadge
,
GlAlert
,
GlSprintf
,
}
from
'
@gitlab/ui
'
;
import
{
__
,
sprintf
,
n__
}
from
'
~/locale
'
;
import
LoadingButton
from
'
~/vue_shared/components/loading_button.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
...
...
@@ -26,6 +34,8 @@
Icon
,
Stacktrace
,
GlBadge
,
GlAlert
,
GlSprintf
,
},
directives
:
{
TrackEvent
:
TrackEventDirective
,
...
...
@@ -85,6 +95,8 @@
return
{
GQLerror
:
null
,
issueCreationInProgress
:
false
,
isAlertVisible
:
false
,
closedIssueId
:
null
,
};
},
computed
:
{
...
...
@@ -184,7 +196,14 @@
onResolveStatusUpdate
()
{
const
status
=
this
.
errorStatus
===
errorStatus
.
RESOLVED
?
errorStatus
.
UNRESOLVED
:
errorStatus
.
RESOLVED
;
this
.
updateResolveStatus
({
endpoint
:
this
.
issueUpdatePath
,
status
});
// eslint-disable-next-line promise/catch-or-return
this
.
updateResolveStatus
({
endpoint
:
this
.
issueUpdatePath
,
status
}).
then
(
res
=>
{
this
.
closedIssueId
=
res
.
closed_issue_iid
;
if
(
this
.
closedIssueId
)
{
this
.
isAlertVisible
=
true
;
}
});
},
formatDate
(
date
)
{
return
`
${
this
.
timeFormatted
(
date
)}
(
${
dateFormat
(
date
,
'
UTC:yyyy-mm-dd h:MM:ssTT Z
'
)}
)`
;
...
...
@@ -199,6 +218,18 @@
<gl-loading-icon
:size=
"3"
/>
</div>
<div
v-else-if=
"showDetails"
class=
"error-details"
>
<gl-alert
v-if=
"isAlertVisible"
@
dismiss=
"isAlertVisible = false"
>
<gl-sprintf
:message=
"
__('The associated issue #%
{issueId} has been closed as the error is now resolved.')
"
>
<template
#issueId
>
<span>
{{
closedIssueId
}}
</span>
</
template
>
</gl-sprintf>
</gl-alert>
<div
class=
"top-area align-items-center justify-content-between py-3"
>
<span
v-if=
"!loadingStacktrace && stacktrace"
v-html=
"reported"
></span>
<div
class=
"d-inline-flex"
>
...
...
app/assets/javascripts/error_tracking/store/actions.js
View file @
bccff663
...
...
@@ -11,5 +11,6 @@
export
const
updateStatus
=
({
commit
},
{
endpoint
,
redirectUrl
,
status
})
=>
service
.
updateErrorStatus
(
endpoint
,
status
)
.
then
(()
=>
{
.
then
(
resp
=>
{
commit
(
types
.
SET_ERROR_STATUS
,
status
);
if
(
redirectUrl
)
visitUrl
(
redirectUrl
);
...
...
@@ -15,5 +16,6 @@
if
(
redirectUrl
)
visitUrl
(
redirectUrl
);
commit
(
types
.
SET_ERROR_STATUS
,
status
);
return
resp
.
data
.
result
;
})
.
catch
(()
=>
createFlash
(
__
(
'
Failed to update issue status
'
)));
...
...
app/assets/javascripts/releases/list/components/release_block_author.vue
View file @
bccff663
...
...
@@ -27,7 +27,7 @@
<
template
>
<div
class=
"d-flex"
>
<gl-sprintf
message=
"by %
{user}">
<gl-sprintf
:
message=
"
__('
by %
{user}
')
">
<template
#user
>
<user-avatar-link
class=
"prepend-left-4"
...
...
app/assets/javascripts/repository/components/last_commit.vue
View file @
bccff663
...
...
@@ -146,4 +146,5 @@
v-if=
"commit.description"
:class=
"{ 'd-block': showDescription }"
class=
"commit-row-description append-bottom-8"
>
{{ commit.description }}
</pre
>
...
...
@@ -149,6 +150,4 @@
>
{{ commit.description }}
</pre>
</div>
<div
class=
"commit-actions flex-row"
>
<div
v-if=
"commit.signatureHtml"
v-html=
"commit.signatureHtml"
></div>
...
...
app/assets/javascripts/snippets/components/snippet_header.vue
View file @
bccff663
...
...
@@ -165,7 +165,7 @@
<
gl
-
icon
:
name
=
"
visibilityLevelIcon
"
:
size
=
"
14
"
/>
<
/div
>
<
div
class
=
"
creator
"
>
<
gl
-
sprintf
message
=
"
Authored %{timeago
}
by %{author
}
"
>
<
gl
-
sprintf
:
message
=
"
__('
Authored %{timeago
}
by %{author
}
')
"
>
<
template
#
timeago
>
<
time
-
ago
-
tooltip
:
time
=
"
snippet.createdAt
"
...
...
@@ -218,7 +218,7 @@
errorMessage
}}
<
/gl-alert
>
<
gl
-
sprintf
message
=
"
Are you sure you want to delete %{name
}
?
"
>
<
gl
-
sprintf
:
message
=
"
__('
Are you sure you want to delete %{name
}
?
')
"
>
<
template
#
name
><
strong
>
{{
snippet
.
title
}}
<
/strong></
template
>
...
...
app/assets/javascripts/snippets/components/snippet_title.vue
View file @
bccff663
...
...
@@ -25,7 +25,7 @@
</div>
<small
v-if=
"snippet.updatedAt !== snippet.createdAt"
class=
"edited-text"
>
<gl-sprintf
message=
"Edited %
{timeago}">
<gl-sprintf
:
message=
"
__('
Edited %
{timeago}
')
">
<template
#timeago
>
<time-ago-tooltip
:time=
"snippet.updatedAt"
tooltip-placement=
"bottom"
/>
</
template
>
...
...
app/models/blob.rb
View file @
bccff663
...
...
@@ -65,7 +65,10 @@
BlobViewer
::
YarnLock
].
freeze
attr_reader
:project
attr_reader
:container
delegate
:repository
,
to: :container
,
allow_nil:
true
delegate
:project
,
to: :repository
,
allow_nil:
true
# Wrap a Gitlab::Git::Blob object, or return nil when given nil
#
...
...
@@ -77,6 +80,6 @@
#
# blob = Blob.decorate(nil)
# puts "truthy" if blob # No output
def
self
.
decorate
(
blob
,
project
=
nil
)
def
self
.
decorate
(
blob
,
container
=
nil
)
return
if
blob
.
nil?
...
...
@@ -81,5 +84,5 @@
return
if
blob
.
nil?
new
(
blob
,
project
)
new
(
blob
,
container
)
end
...
...
@@ -84,10 +87,10 @@
end
def
self
.
lazy
(
project
,
commit_id
,
path
,
blob_size_limit:
Gitlab
::
Git
::
Blob
::
MAX_DATA_DISPLAY_SIZE
)
BatchLoader
.
for
([
commit_id
,
path
]).
batch
(
key:
project
.
repository
)
do
|
items
,
loader
,
args
|
def
self
.
lazy
(
container
,
commit_id
,
path
,
blob_size_limit:
Gitlab
::
Git
::
Blob
::
MAX_DATA_DISPLAY_SIZE
)
BatchLoader
.
for
([
commit_id
,
path
]).
batch
(
key:
container
.
repository
)
do
|
items
,
loader
,
args
|
args
[
:key
].
blobs_at
(
items
,
blob_size_limit:
blob_size_limit
).
each
do
|
blob
|
loader
.
call
([
blob
.
commit_id
,
blob
.
path
],
blob
)
if
blob
end
end
end
...
...
@@ -88,11 +91,11 @@
args
[
:key
].
blobs_at
(
items
,
blob_size_limit:
blob_size_limit
).
each
do
|
blob
|
loader
.
call
([
blob
.
commit_id
,
blob
.
path
],
blob
)
if
blob
end
end
end
def
initialize
(
blob
,
project
=
nil
)
@
project
=
project
def
initialize
(
blob
,
container
=
nil
)
@
container
=
container
super
(
blob
)
end
...
...
@@ -116,7 +119,7 @@
def
load_all_data!
# Endpoint needed: https://gitlab.com/gitlab-org/gitaly/issues/756
Gitlab
::
GitalyClient
.
allow_n_plus_1_calls
do
super
(
project
.
repository
)
if
project
super
(
repository
)
if
container
end
end
...
...
app/models/commit.rb
View file @
bccff663
...
...
@@ -21,7 +21,7 @@
participant
:committer
participant
:notes_with_associations
attr_accessor
:project
,
:author
attr_accessor
:author
attr_accessor
:redacted_description_html
attr_accessor
:redacted_title_html
attr_accessor
:redacted_full_title_html
...
...
@@ -25,7 +25,10 @@
attr_accessor
:redacted_description_html
attr_accessor
:redacted_title_html
attr_accessor
:redacted_full_title_html
attr_reader
:gpg_commit
attr_reader
:gpg_commit
,
:container
delegate
:repository
,
to: :container
delegate
:project
,
to: :repository
,
allow_nil:
true
DIFF_SAFE_LINES
=
Gitlab
::
Git
::
DiffCollection
::
DEFAULT_LIMITS
[
:max_lines
]
...
...
@@ -44,8 +47,8 @@
cache_markdown_field
:description
,
pipeline: :commit_description
class
<<
self
def
decorate
(
commits
,
project
)
def
decorate
(
commits
,
container
)
commits
.
map
do
|
commit
|
if
commit
.
is_a?
(
Commit
)
commit
else
...
...
@@ -48,8 +51,8 @@
commits
.
map
do
|
commit
|
if
commit
.
is_a?
(
Commit
)
commit
else
self
.
new
(
commit
,
project
)
self
.
new
(
commit
,
container
)
end
end
end
...
...
@@ -85,12 +88,12 @@
}
end
def
from_hash
(
hash
,
project
)
raw_commit
=
Gitlab
::
Git
::
Commit
.
new
(
project
.
repository
.
raw
,
hash
)
new
(
raw_commit
,
project
)
def
from_hash
(
hash
,
container
)
raw_commit
=
Gitlab
::
Git
::
Commit
.
new
(
container
.
repository
.
raw
,
hash
)
new
(
raw_commit
,
container
)
end
def
valid_hash?
(
key
)
!!
(
EXACT_COMMIT_SHA_PATTERN
=~
key
)
end
...
...
@@ -91,10 +94,10 @@
end
def
valid_hash?
(
key
)
!!
(
EXACT_COMMIT_SHA_PATTERN
=~
key
)
end
def
lazy
(
project
,
oid
)
BatchLoader
.
for
({
project:
project
,
oid:
oid
}).
batch
(
replace_methods:
false
)
do
|
items
,
loader
|
items_by_
project
=
items
.
group_by
{
|
i
|
i
[
:
project
]
}
def
lazy
(
container
,
oid
)
BatchLoader
.
for
({
container:
container
,
oid:
oid
}).
batch
(
replace_methods:
false
)
do
|
items
,
loader
|
items_by_
container
=
items
.
group_by
{
|
i
|
i
[
:
container
]
}
...
...
@@ -100,4 +103,4 @@
items_by_
project
.
each
do
|
project
,
commit_ids
|
items_by_
container
.
each
do
|
container
,
commit_ids
|
oids
=
commit_ids
.
map
{
|
i
|
i
[
:oid
]
}
...
...
@@ -102,7 +105,7 @@
oids
=
commit_ids
.
map
{
|
i
|
i
[
:oid
]
}
project
.
repository
.
commits_by
(
oids:
oids
).
each
do
|
commit
|
loader
.
call
({
project:
commit
.
project
,
oid:
commit
.
id
},
commit
)
if
commit
container
.
repository
.
commits_by
(
oids:
oids
).
each
do
|
commit
|
loader
.
call
({
container:
commit
.
container
,
oid:
commit
.
id
},
commit
)
if
commit
end
end
end
...
...
@@ -115,7 +118,7 @@
attr_accessor
:raw
def
initialize
(
raw_commit
,
project
)
def
initialize
(
raw_commit
,
container
)
raise
"Nil as raw commit passed"
unless
raw_commit
@raw
=
raw_commit
...
...
@@ -119,8 +122,8 @@
raise
"Nil as raw commit passed"
unless
raw_commit
@raw
=
raw_commit
@
project
=
project
@gpg_commit
=
Gitlab
::
Gpg
::
Commit
.
new
(
self
)
if
project
@
container
=
container
@gpg_commit
=
Gitlab
::
Gpg
::
Commit
.
new
(
self
)
if
container
end
delegate
\
...
...
@@ -141,7 +144,7 @@
end
def
project_id
project
.
id
project
&
.
id
end
def
==
(
other
)
...
...
@@ -269,8 +272,8 @@
end
def
parents
@parents
||=
parent_ids
.
map
{
|
oid
|
Commit
.
lazy
(
project
,
oid
)
}
@parents
||=
parent_ids
.
map
{
|
oid
|
Commit
.
lazy
(
container
,
oid
)
}
end
def
parent
strong_memoize
(
:parent
)
do
...
...
@@ -273,9 +276,9 @@
end
def
parent
strong_memoize
(
:parent
)
do
project
.
commit_by
(
oid:
self
.
parent_id
)
if
self
.
parent_id
container
.
commit_by
(
oid:
self
.
parent_id
)
if
self
.
parent_id
end
end
def
notes
...
...
@@ -278,8 +281,8 @@
end
end
def
notes
project
.
notes
.
for_commit_id
(
self
.
id
)
container
.
notes
.
for_commit_id
(
self
.
id
)
end
def
user_mentions
...
...
@@ -295,7 +298,7 @@
end
def
merge_requests
@merge_requests
||=
project
.
merge_requests
.
by_commit_sha
(
sha
)
@merge_requests
||=
project
&
.
merge_requests
&
.
by_commit_sha
(
sha
)
end
def
method_missing
(
method
,
*
args
,
&
block
)
...
...
@@ -330,7 +333,7 @@
end
def
cherry_pick_branch_name
project
.
repository
.
next_branch
(
"cherry-pick-
#{
short_id
}
"
,
mild:
true
)
repository
.
next_branch
(
"cherry-pick-
#{
short_id
}
"
,
mild:
true
)
end
def
cherry_pick_description
(
user
)
...
...
@@ -418,7 +421,7 @@
return
unless
entry
if
entry
[
:type
]
==
:blob
blob
=
::
Blob
.
decorate
(
Gitlab
::
Git
::
Blob
.
new
(
name:
entry
[
:name
]),
@project
)
blob
=
::
Blob
.
decorate
(
Gitlab
::
Git
::
Blob
.
new
(
name:
entry
[
:name
]),
container
)
blob
.
image?
||
blob
.
video?
||
blob
.
audio?
?
:raw
:
:blob
else
entry
[
:type
]
...
...
@@ -484,7 +487,7 @@
end
def
commit_reference
(
from
,
referable_commit_id
,
full:
false
)
base
=
project
.
to_reference_base
(
from
,
full:
full
)
base
=
project
&
.
to_reference_base
(
from
,
full:
full
)
if
base
.
present?
"
#{
base
}#{
self
.
class
.
reference_prefix
}#{
referable_commit_id
}
"
...
...
@@ -510,6 +513,6 @@
end
def
merged_merge_request_no_cache
(
user
)
MergeRequestsFinder
.
new
(
user
,
project_id:
project
.
id
).
find_by
(
merge_commit_sha:
id
)
if
merge_commit?
MergeRequestsFinder
.
new
(
user
,
project_id:
project
_
id
).
find_by
(
merge_commit_sha:
id
)
if
merge_commit?
end
end
app/models/commit_collection.rb
View file @
bccff663
# frozen_string_literal: true
# A collection of Commit instances for a specific
project
and Git reference.
# A collection of Commit instances for a specific
container
and Git reference.
class
CommitCollection
include
Enumerable
include
Gitlab
::
Utils
::
StrongMemoize
...
...
@@ -4,6 +4,6 @@
class
CommitCollection
include
Enumerable
include
Gitlab
::
Utils
::
StrongMemoize
attr_reader
:
project
,
:ref
,
:commits
attr_reader
:
container
,
:ref
,
:commits
...
...
@@ -9,4 +9,7 @@
# project - The project the commits belong to.
delegate
:repository
,
to: :container
,
allow_nil:
true
delegate
:project
,
to: :repository
,
allow_nil:
true
# container - The object the commits belong to.
# commits - The Commit instances to store.
# ref - The name of the ref (e.g. "master").
...
...
@@ -11,7 +14,7 @@
# commits - The Commit instances to store.
# ref - The name of the ref (e.g. "master").
def
initialize
(
project
,
commits
,
ref
=
nil
)
@
project
=
project
def
initialize
(
container
,
commits
,
ref
=
nil
)
@
container
=
container
@commits
=
commits
@ref
=
ref
end
...
...
@@ -39,6 +42,8 @@
# Setting the pipeline for each commit ahead of time removes the need for running
# a query for every commit we're displaying.
def
with_latest_pipeline
(
ref
=
nil
)
return
self
unless
project
pipelines
=
project
.
ci_pipelines
.
latest_pipeline_per_commit
(
map
(
&
:id
),
ref
)
each
do
|
commit
|
...
...
@@ -59,7 +64,7 @@
# Batch load any commits that are not backed by full gitaly data, and
# replace them in the collection.
def
enrich!
# A
project
is needed in order to fetch data from gitaly.
Project
s
# A
container
is needed in order to fetch data from gitaly.
Container
s
# can be absent from commits in certain rare situations (like when
# viewing a MR of a deleted fork). In these cases, assume that the
# enriched data is not needed.
...
...
@@ -63,8 +68,8 @@
# can be absent from commits in certain rare situations (like when
# viewing a MR of a deleted fork). In these cases, assume that the
# enriched data is not needed.
return
self
if
project
.
blank?
||
fully_enriched?
return
self
if
container
.
blank?
||
fully_enriched?
# Batch load full Commits from the repository
# and map to a Hash of id => Commit
replacements
=
Hash
[
unenriched
.
map
do
|
c
|
...
...
@@ -67,8 +72,8 @@
# Batch load full Commits from the repository
# and map to a Hash of id => Commit
replacements
=
Hash
[
unenriched
.
map
do
|
c
|
[
c
.
id
,
Commit
.
lazy
(
project
,
c
.
id
)]
[
c
.
id
,
Commit
.
lazy
(
container
,
c
.
id
)]
end
.
compact
]
# Replace the commits, keeping the same order
...
...
app/models/concerns/has_repository.rb
0 → 100644
View file @
bccff663
# frozen_string_literal: true
module
HasRepository
extend
ActiveSupport
::
Concern
include
Gitlab
::
ShellAdapter
include
AfterCommitQueue
include
Gitlab
::
Utils
::
StrongMemoize
delegate
:base_dir
,
:disk_path
,
to: :storage
def
valid_repo?
repository
.
exists?
rescue
errors
.
add
(
:path
,
_
(
'Invalid repository path'
))
false
end
def
repo_exists?
strong_memoize
(
:repo_exists
)
do
repository
.
exists?
rescue
false
end
end
def
repository_exists?
!!
repository
.
exists?
end
def
root_ref?
(
branch
)
repository
.
root_ref
==
branch
end
def
commit
(
ref
=
'HEAD'
)
repository
.
commit
(
ref
)
end
def
commit_by
(
oid
:)
repository
.
commit_by
(
oid:
oid
)
end
def
commits_by
(
oids
:)
repository
.
commits_by
(
oids:
oids
)
end
def
repository
raise
NotImplementedError
end
def
storage
raise
NotImplementedError
end
def
full_path
raise
NotImplementedError
end
def
empty_repo?
repository
.
empty?
end
def
default_branch
@default_branch
||=
repository
.
root_ref
end
def
reload_default_branch
@default_branch
=
nil
# rubocop:disable Gitlab/ModuleWithInstanceVariables
default_branch
end
def
url_to_repo
gitlab_shell
.
url_to_repo
(
full_path
)
end
def
ssh_url_to_repo
url_to_repo
end
def
http_url_to_repo
custom_root
=
Gitlab
::
CurrentSettings
.
custom_http_clone_url_root
url
=
if
custom_root
.
present?
Gitlab
::
Utils
.
append_path
(
custom_root
,
web_url
(
only_path:
true
)
)
else
web_url
end
"
#{
url
}
.git"
end
def
web_url
(
only_path:
nil
)
raise
NotImplementedError
end
end
app/models/project.rb
View file @
bccff663
...
...
@@ -19,6 +19,7 @@
include
ProjectFeaturesCompatibility
include
SelectForProjectAuthorization
include
Presentable
include
HasRepository
include
Routable
include
GroupDescendant
include
Gitlab
::
SQL
::
Pattern
...
...
@@ -326,7 +327,6 @@
to: :project_feature
,
allow_nil:
true
delegate
:scheduled?
,
:started?
,
:in_progress?
,
:failed?
,
:finished?
,
prefix: :import
,
to: :import_state
,
allow_nil:
true
delegate
:base_dir
,
:disk_path
,
to: :storage
delegate
:no_import?
,
to: :import_state
,
allow_nil:
true
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
delegate
:members
,
to: :team
,
prefix:
true
...
...
@@ -767,10 +767,6 @@
Feature
.
enabled?
(
:context_commits
,
default_enabled:
true
)
end
def
empty_repo?
repository
.
empty?
end
def
team
@team
||=
ProjectTeam
.
new
(
self
)
end
...
...
@@ -798,18 +794,6 @@
has_root_container_repository_tags?
end
def
commit
(
ref
=
'HEAD'
)
repository
.
commit
(
ref
)
end
def
commit_by
(
oid
:)
repository
.
commit_by
(
oid:
oid
)
end
def
commits_by
(
oids
:)
repository
.
commits_by
(
oids:
oids
)
end
# ref can't be HEAD, can only be branch/tag name
def
latest_successful_build_for_ref
(
job_name
,
ref
=
default_branch
)
return
unless
ref
...
...
@@ -1357,48 +1341,6 @@
services
.
public_send
(
hooks_scope
).
any?
# rubocop:disable GitlabSecurity/PublicSend
end
def
valid_repo?
repository
.
exists?
rescue
errors
.
add
(
:path
,
_
(
'Invalid repository path'
))
false
end
def
url_to_repo
gitlab_shell
.
url_to_repo
(
full_path
)
end
def
repo_exists?