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
e1cff4bb
Commit
e1cff4bb
authored
Apr 13, 2018
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ce-to-ee-2018-04-13' into 'master'
CE upstream - 2018-04-13 09:32 UTC See merge request gitlab-org/gitlab-ee!5359
parents
6cbc7dd2
adbf8b8a
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
154 additions
and
38 deletions
+154
-38
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+21
-28
app/assets/stylesheets/pages/repo.scss
app/assets/stylesheets/pages/repo.scss
+2
-1
changelogs/no-rm-rf-gitlab-basics.yml
changelogs/no-rm-rf-gitlab-basics.yml
+5
-0
changelogs/unreleased/docs-for-failure-reason-tooltip.yml
changelogs/unreleased/docs-for-failure-reason-tooltip.yml
+5
-0
changelogs/unreleased/feature-add-language-in-repository-to-api.yml
.../unreleased/feature-add-language-in-repository-to-api.yml
+5
-0
config/initializers/deprecations.rb
config/initializers/deprecations.rb
+5
-0
doc/api/projects.md
doc/api/projects.md
+23
-0
doc/ci/img/job_failure_reason.png
doc/ci/img/job_failure_reason.png
+0
-0
doc/ci/pipelines.md
doc/ci/pipelines.md
+16
-0
doc/gitlab-basics/command-line-commands.md
doc/gitlab-basics/command-line-commands.md
+1
-1
lib/api/projects.rb
lib/api/projects.rb
+5
-0
lib/gitlab.rb
lib/gitlab.rb
+8
-0
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+10
-8
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+48
-0
No files found.
app/assets/javascripts/merge_request_tabs.js
View file @
e1cff4bb
...
...
@@ -7,11 +7,7 @@ import flash from './flash';
import
BlobForkSuggestion
from
'
./blob/blob_fork_suggestion
'
;
import
initChangesDropdown
from
'
./init_changes_dropdown
'
;
import
bp
from
'
./breakpoints
'
;
import
{
parseUrlPathname
,
handleLocationHash
,
isMetaClick
,
}
from
'
./lib/utils/common_utils
'
;
import
{
parseUrlPathname
,
handleLocationHash
,
isMetaClick
}
from
'
./lib/utils/common_utils
'
;
import
{
getLocationHash
}
from
'
./lib/utils/url_utility
'
;
import
initDiscussionTab
from
'
./image_diff/init_discussion_tab
'
;
import
Diff
from
'
./diff
'
;
...
...
@@ -69,11 +65,10 @@ import Notes from './notes';
let
location
=
window
.
location
;
export
default
class
MergeRequestTabs
{
constructor
({
action
,
setUrl
,
stubLocation
}
=
{})
{
const
mergeRequestTabs
=
document
.
querySelector
(
'
.js-tabs-affix
'
);
const
navbar
=
document
.
querySelector
(
'
.navbar-gitlab
'
);
const
peek
=
document
.
getElementById
(
'
peek
'
);
const
peek
=
document
.
getElementById
(
'
js-
peek
'
);
const
paddingTop
=
16
;
this
.
diffsLoaded
=
false
;
...
...
@@ -109,8 +104,7 @@ export default class MergeRequestTabs {
.
on
(
'
shown.bs.tab
'
,
'
.merge-request-tabs a[data-toggle="tab"]
'
,
this
.
tabShown
)
.
on
(
'
click
'
,
'
.js-show-tab
'
,
this
.
showTab
);
$
(
'
.merge-request-tabs a[data-toggle="tab"]
'
)
.
on
(
'
click
'
,
this
.
clickTab
);
$
(
'
.merge-request-tabs a[data-toggle="tab"]
'
).
on
(
'
click
'
,
this
.
clickTab
);
}
// Used in tests
...
...
@@ -119,8 +113,7 @@ export default class MergeRequestTabs {
.
off
(
'
shown.bs.tab
'
,
'
.merge-request-tabs a[data-toggle="tab"]
'
,
this
.
tabShown
)
.
off
(
'
click
'
,
'
.js-show-tab
'
,
this
.
showTab
);
$
(
'
.merge-request-tabs a[data-toggle="tab"]
'
)
.
off
(
'
click
'
,
this
.
clickTab
);
$
(
'
.merge-request-tabs a[data-toggle="tab"]
'
).
off
(
'
click
'
,
this
.
clickTab
);
}
destroyPipelinesView
()
{
...
...
@@ -183,10 +176,7 @@ export default class MergeRequestTabs {
scrollToElement
(
container
)
{
if
(
location
.
hash
)
{
const
offset
=
0
-
(
$
(
'
.navbar-gitlab
'
).
outerHeight
()
+
$
(
'
.js-tabs-affix
'
).
outerHeight
()
);
const
offset
=
0
-
(
$
(
'
.navbar-gitlab
'
).
outerHeight
()
+
$
(
'
.js-tabs-affix
'
).
outerHeight
());
const
$el
=
$
(
`
${
container
}
${
location
.
hash
}
:not(.match)`
);
if
(
$el
.
length
)
{
$
.
scrollTo
(
$el
[
0
],
{
offset
});
...
...
@@ -240,9 +230,13 @@ export default class MergeRequestTabs {
// Turbolinks' history.
//
// See https://github.com/rails/turbolinks/issues/363
window
.
history
.
replaceState
({
url
:
newState
,
},
document
.
title
,
newState
);
window
.
history
.
replaceState
(
{
url
:
newState
,
},
document
.
title
,
newState
,
);
return
newState
;
}
...
...
@@ -258,7 +252,8 @@ export default class MergeRequestTabs {
this
.
toggleLoading
(
true
);
axios
.
get
(
`
${
source
}
.json`
)
axios
.
get
(
`
${
source
}
.json`
)
.
then
(({
data
})
=>
{
document
.
querySelector
(
'
div#commits
'
).
innerHTML
=
data
.
html
;
localTimeAgo
(
$
(
'
.js-timeago
'
,
'
div#commits
'
));
...
...
@@ -303,7 +298,8 @@ export default class MergeRequestTabs {
this
.
toggleLoading
(
true
);
axios
.
get
(
`
${
urlPathname
}
.json
${
location
.
search
}
`
)
axios
.
get
(
`
${
urlPathname
}
.json
${
location
.
search
}
`
)
.
then
(({
data
})
=>
{
const
$container
=
$
(
'
#diffs
'
);
$container
.
html
(
data
.
html
);
...
...
@@ -332,8 +328,7 @@ export default class MergeRequestTabs {
cancelButtons
:
$
(
el
).
find
(
'
.js-cancel-fork-suggestion-button
'
),
suggestionSections
:
$
(
el
).
find
(
'
.js-file-fork-suggestion-section
'
),
actionTextPieces
:
$
(
el
).
find
(
'
.js-file-fork-suggestion-section-action
'
),
})
.
init
();
}).
init
();
});
// Scroll any linked note into view
...
...
@@ -388,8 +383,7 @@ export default class MergeRequestTabs {
resetViewContainer
()
{
if
(
this
.
fixedLayoutPref
!==
null
)
{
$
(
'
.content-wrapper .container-fluid
'
)
.
toggleClass
(
'
container-limited
'
,
this
.
fixedLayoutPref
);
$
(
'
.content-wrapper .container-fluid
'
).
toggleClass
(
'
container-limited
'
,
this
.
fixedLayoutPref
);
}
}
...
...
@@ -438,12 +432,11 @@ export default class MergeRequestTabs {
const
$diffTabs
=
$
(
'
#diff-notes-app
'
);
$tabs
.
off
(
'
affix.bs.affix affix-top.bs.affix
'
)
$tabs
.
off
(
'
affix.bs.affix affix-top.bs.affix
'
)
.
affix
({
offset
:
{
top
:
()
=>
(
$diffTabs
.
offset
().
top
-
$tabs
.
height
()
-
$fixedNav
.
height
()
),
top
:
()
=>
$diffTabs
.
offset
().
top
-
$tabs
.
height
()
-
$fixedNav
.
height
(),
},
})
.
on
(
'
affix.bs.affix
'
,
()
=>
$diffTabs
.
css
({
marginTop
:
$tabs
.
height
()
}))
...
...
app/assets/stylesheets/pages/repo.scss
View file @
e1cff4bb
...
...
@@ -429,6 +429,7 @@
.projects-sidebar
{
display
:
flex
;
flex-direction
:
column
;
height
:
100%
;
.context-header
{
width
:
auto
;
...
...
@@ -438,8 +439,8 @@
.multi-file-commit-panel-inner
{
display
:
flex
;
flex
:
1
;
flex-direction
:
column
;
height
:
100%
;
}
.multi-file-commit-panel-inner-scroll
{
...
...
changelogs/no-rm-rf-gitlab-basics.yml
0 → 100644
View file @
e1cff4bb
---
title
:
Do not use '-f' with 'rm' in gitlab-basics docs
merge_request
:
18027
author
:
Elias Werberich
type
:
changed
changelogs/unreleased/docs-for-failure-reason-tooltip.yml
0 → 100644
View file @
e1cff4bb
---
title
:
Add documentation for Pipelines failure reasons
merge_request
:
18352
author
:
type
:
other
changelogs/unreleased/feature-add-language-in-repository-to-api.yml
0 → 100644
View file @
e1cff4bb
---
title
:
'
API:
add
languages
of
project
GET
/projects/:id/languages'
merge_request
:
17770
author
:
Roger Rüttimann
type
:
added
config/initializers/deprecations.rb
0 → 100644
View file @
e1cff4bb
deprecator
=
ActiveSupport
::
Deprecation
.
new
(
'11.0'
,
'GitLab'
)
if
Gitlab
.
inc_controlled?
||
Rails
.
env
.
development?
ActiveSupport
::
Deprecation
.
deprecate_methods
(
Gitlab
::
GitalyClient
::
StorageSettings
,
:legacy_disk_path
,
deprecator:
deprecator
)
end
doc/api/projects.md
View file @
e1cff4bb
...
...
@@ -942,6 +942,29 @@ Example response:
}
```
## Languages
Get languages used in a project with percentage value.
```
GET /projects/:id/languages
```
```
bash
curl
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
"https://gitlab.example.com/api/v4/projects/5/languages"
```
Example response:
```
json
{
"Ruby"
:
66.69
,
"JavaScript"
:
22.98
,
"HTML"
:
7.91
,
"CoffeeScript"
:
2.42
}
```
## Archive a project
Archives the project if the user is either admin or the project owner of this project. This action is
...
...
doc/ci/img/job_failure_reason.png
0 → 100644
View file @
e1cff4bb
5.22 KB
doc/ci/pipelines.md
View file @
e1cff4bb
...
...
@@ -73,6 +73,21 @@ cancel the job, retry it, or erase the job trace.
![
Pipelines example
](
img/pipelines.png
)
## Seeing the failure reason for jobs
> [Introduced][ce-5742] in GitLab 10.7.
When a pipeline fails or is allowed to fail, there are several places where you
can quickly check the reason it failed:
-
**In the pipeline graph**
present on the pipeline detail view.
-
**In the pipeline widgets**
present in the merge requests and commit pages.
-
**In the job views**
present in the global and detailed views of a job.
In any case, if you hover over the failed job you can see the reason it failed.
![
Pipeline detail
](
img/job_failure_reason.png
)
## Pipeline graphs
> [Introduced][ce-5742] in GitLab 8.11.
...
...
@@ -270,6 +285,7 @@ runners will not use regular runners, they must be tagged accordingly.
[
ce-6242
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6242
[
ce-7931
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7931
[
ce-9760
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9760
[
ce-17782
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17782
[
regexp
]:
https://gitlab.com/gitlab-org/gitlab-ce/blob/2f3dc314f42dbd79813e6251792853bc231e69dd/app/models/commit_status.rb#L99
[
eep
]:
https://about.gitlab.com/products/
"GitLab Premium"
[
ee-2121
]:
https://gitlab.com/gitlab-org/gitlab-ee/issues/2121
doc/gitlab-basics/command-line-commands.md
View file @
e1cff4bb
...
...
@@ -71,7 +71,7 @@ rm NAME-OF-FILE
### Remove a directory and all of its contents
```
rm -r
f
NAME-OF-DIRECTORY
rm -r NAME-OF-DIRECTORY
```
### View history in the command line
...
...
lib/api/projects.rb
View file @
e1cff4bb
...
...
@@ -345,6 +345,11 @@ module API
end
end
desc
'Get languages in project repository'
get
':id/languages'
do
user_project
.
repository
.
languages
.
map
{
|
language
|
language
.
values_at
(
:label
,
:value
)
}.
to_h
end
desc
'Remove a project'
delete
":id"
do
authorize!
:remove_project
,
user_project
...
...
lib/gitlab.rb
View file @
e1cff4bb
...
...
@@ -19,4 +19,12 @@ module Gitlab
def
self
.
dev_env_or_com?
Rails
.
env
.
test?
||
Rails
.
env
.
development?
||
com?
end
def
self
.
dev?
Gitlab
.
config
.
gitlab
.
url
==
'https://dev.gitlab.org'
end
def
self
.
inc_controlled?
dev?
||
com?
end
end
lib/gitlab/git/repository.rb
View file @
e1cff4bb
...
...
@@ -75,9 +75,6 @@ module Gitlab
end
end
# Full path to repo
attr_reader
:path
# Directory name of repo
attr_reader
:name
...
...
@@ -96,14 +93,13 @@ module Gitlab
@relative_path
=
relative_path
@gl_repository
=
gl_repository
storage_path
=
Gitlab
.
config
.
repositories
.
storages
[
@storage
].
legacy_disk_path
@gitlab_projects
=
Gitlab
::
Git
::
GitlabProjects
.
new
(
storage
,
relative_path
,
global_hooks_path:
Gitlab
.
config
.
gitlab_shell
.
hooks_path
,
logger:
Rails
.
logger
)
@path
=
File
.
join
(
storage_path
,
@relative_path
)
@name
=
@relative_path
.
split
(
"/"
).
last
end
...
...
@@ -111,6 +107,12 @@ module Gitlab
path
==
other
.
path
end
def
path
@path
||=
File
.
join
(
Gitlab
.
config
.
repositories
.
storages
[
@storage
].
legacy_disk_path
,
@relative_path
)
end
# Default branch in the repository
def
root_ref
@root_ref
||=
gitaly_migrate
(
:root_ref
)
do
|
is_enabled
|
...
...
@@ -139,12 +141,12 @@ module Gitlab
end
def
exists?
Gitlab
::
GitalyClient
.
migrate
(
:repository_exists
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
do
|
enabled
|
Gitlab
::
GitalyClient
.
migrate
(
:repository_exists
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
do
|
enabled
|
if
enabled
gitaly_repository_client
.
exists?
else
circuit_breaker
.
perform
do
File
.
exist?
(
File
.
join
(
@
path
,
'refs'
))
File
.
exist?
(
File
.
join
(
path
,
'refs'
))
end
end
end
...
...
@@ -1022,7 +1024,7 @@ module Gitlab
if
is_enabled
gitaly_repository_client
.
info_attributes
else
attributes_path
=
File
.
join
(
File
.
expand_path
(
@
path
),
'info'
,
'attributes'
)
attributes_path
=
File
.
join
(
File
.
expand_path
(
path
),
'info'
,
'attributes'
)
if
File
.
exist?
(
attributes_path
)
File
.
read
(
attributes_path
)
...
...
spec/requests/api/projects_spec.rb
View file @
e1cff4bb
# -*- coding: utf-8 -*-
require
'spec_helper'
shared_examples
'languages and percentages JSON response'
do
let
(
:expected_languages
)
{
project
.
repository
.
languages
.
map
{
|
language
|
language
.
values_at
(
:label
,
:value
)}.
to_h
}
it
'returns expected language values'
do
get
api
(
"/projects/
#{
project
.
id
}
/languages"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
(
expected_languages
)
expect
(
json_response
.
count
).
to
be
>
1
end
end
describe
API
::
Projects
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
...
...
@@ -1760,6 +1772,42 @@ describe API::Projects do
end
end
describe
'GET /projects/:id/languages'
do
context
'with an authorized user'
do
it_behaves_like
'languages and percentages JSON response'
do
let
(
:project
)
{
project3
}
end
it
'returns not_found(404) for not existing project'
do
get
api
(
"/projects/9999999999/languages"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'with not authorized user'
do
it
'returns not_found for existing but unauthorized project'
do
get
api
(
"/projects/
#{
project3
.
id
}
/languages"
,
user3
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'without user'
do
let
(
:project_public
)
{
create
(
:project
,
:public
,
:repository
)
}
it_behaves_like
'languages and percentages JSON response'
do
let
(
:project
)
{
project_public
}
end
it
'returns not_found for existing but unauthorized project'
do
get
api
(
"/projects/
#{
project3
.
id
}
/languages"
,
nil
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
describe
'DELETE /projects/:id'
do
context
'when authenticated as user'
do
it
'removes project'
do
...
...
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