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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
62c8bc22
Commit
62c8bc22
authored
Jul 07, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
faa535ec
474d798c
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
253 additions
and
19 deletions
+253
-19
CHANGELOG
CHANGELOG
+4
-0
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+2
-2
app/controllers/projects/graphs_controller.rb
app/controllers/projects/graphs_controller.rb
+5
-2
app/controllers/projects/refs_controller.rb
app/controllers/projects/refs_controller.rb
+15
-11
app/views/projects/graphs/commits.html.haml
app/views/projects/graphs/commits.html.haml
+3
-1
app/views/projects/graphs/show.html.haml
app/views/projects/graphs/show.html.haml
+4
-2
doc/api/README.md
doc/api/README.md
+1
-0
doc/api/settings.md
doc/api/settings.md
+88
-0
doc/update/mysql_to_postgresql.md
doc/update/mysql_to_postgresql.md
+4
-1
lib/api/api.rb
lib/api/api.rb
+1
-0
lib/api/entities.rb
lib/api/entities.rb
+22
-0
lib/api/settings.rb
lib/api/settings.rb
+35
-0
lib/backup/database.rb
lib/backup/database.rb
+14
-0
spec/controllers/branches_controller_spec.rb
spec/controllers/branches_controller_spec.rb
+26
-0
spec/requests/api/settings_spec.rb
spec/requests/api/settings_spec.rb
+29
-0
No files found.
CHANGELOG
View file @
62c8bc22
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 7.13.0 (unreleased)
v 7.13.0 (unreleased)
- Fix redirection to home page URL for unauthorized users (Daniel Gerhardt)
- Fix redirection to home page URL for unauthorized users (Daniel Gerhardt)
- Add branch switching support for graphs (Daniel Gerhardt)
- Fix external issue tracker hook/test for HTTPS URLs (Daniel Gerhardt)
- Fix external issue tracker hook/test for HTTPS URLs (Daniel Gerhardt)
- Remove link leading to a 404 error in Deploy Keys page (Stan Hu)
- Remove link leading to a 404 error in Deploy Keys page (Stan Hu)
- Add support for unlocking users in admin settings (Stan Hu)
- Add support for unlocking users in admin settings (Stan Hu)
...
@@ -19,6 +20,7 @@ v 7.13.0 (unreleased)
...
@@ -19,6 +20,7 @@ v 7.13.0 (unreleased)
- Update maintenance documentation to explain no need to recompile asssets for omnibus installations (Stan Hu)
- Update maintenance documentation to explain no need to recompile asssets for omnibus installations (Stan Hu)
- Support commenting on diffs in side-by-side mode (Stan Hu)
- Support commenting on diffs in side-by-side mode (Stan Hu)
- Fix JavaScript error when clicking on the comment button on a diff line that has a comment already (Stan Hu)
- Fix JavaScript error when clicking on the comment button on a diff line that has a comment already (Stan Hu)
- Return 40x error codes if branch could not be deleted in UI (Stan Hu)
- Remove project visibility icons from dashboard projects list
- Remove project visibility icons from dashboard projects list
- Rename "Design" profile settings page to "Preferences".
- Rename "Design" profile settings page to "Preferences".
- Allow users to customize their default Dashboard page.
- Allow users to customize their default Dashboard page.
...
@@ -51,6 +53,8 @@ v 7.12.1
...
@@ -51,6 +53,8 @@ v 7.12.1
- Fix closed merge request scope at milestone page (Dmitriy Zaporozhets)
- Fix closed merge request scope at milestone page (Dmitriy Zaporozhets)
- Revert merge request states renaming
- Revert merge request states renaming
- Fix hooks for web based events with external issue references (Daniel Gerhardt)
- Fix hooks for web based events with external issue references (Daniel Gerhardt)
- Improve performance for issue and merge request pages
- Compress database dumps to reduce backup size
v 7.12.0
v 7.12.0
- Fix Error 500 when one user attempts to access a personal, internal snippet (Stan Hu)
- Fix Error 500 when one user attempts to access a personal, internal snippet (Stan Hu)
...
...
app/controllers/projects/branches_controller.rb
View file @
62c8bc22
...
@@ -32,7 +32,7 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -32,7 +32,7 @@ class Projects::BranchesController < Projects::ApplicationController
end
end
def
destroy
def
destroy
DeleteBranchService
.
new
(
project
,
current_user
).
execute
(
params
[
:id
])
status
=
DeleteBranchService
.
new
(
project
,
current_user
).
execute
(
params
[
:id
])
@branch_name
=
params
[
:id
]
@branch_name
=
params
[
:id
]
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -40,7 +40,7 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -40,7 +40,7 @@ class Projects::BranchesController < Projects::ApplicationController
redirect_to
namespace_project_branches_path
(
@project
.
namespace
,
redirect_to
namespace_project_branches_path
(
@project
.
namespace
,
@project
)
@project
)
end
end
format
.
js
format
.
js
{
render
status:
status
[
:return_code
]
}
end
end
end
end
end
end
app/controllers/projects/graphs_controller.rb
View file @
62c8bc22
class
Projects::GraphsController
<
Projects
::
ApplicationController
class
Projects::GraphsController
<
Projects
::
ApplicationController
include
ExtractsPath
# Authorize
# Authorize
before_action
:require_non_empty_project
before_action
:require_non_empty_project
before_action
:assign_ref_vars
before_action
:authorize_download_code!
before_action
:authorize_download_code!
def
show
def
show
...
@@ -13,7 +16,7 @@ class Projects::GraphsController < Projects::ApplicationController
...
@@ -13,7 +16,7 @@ class Projects::GraphsController < Projects::ApplicationController
end
end
def
commits
def
commits
@commits
=
@project
.
repository
.
commits
(
nil
,
nil
,
2000
,
0
,
true
)
@commits
=
@project
.
repository
.
commits
(
@ref
,
nil
,
2000
,
0
,
true
)
@commits_graph
=
Gitlab
::
Graphs
::
Commits
.
new
(
@commits
)
@commits_graph
=
Gitlab
::
Graphs
::
Commits
.
new
(
@commits
)
@commits_per_week_days
=
@commits_graph
.
commits_per_week_days
@commits_per_week_days
=
@commits_graph
.
commits_per_week_days
@commits_per_time
=
@commits_graph
.
commits_per_time
@commits_per_time
=
@commits_graph
.
commits_per_time
...
@@ -23,7 +26,7 @@ class Projects::GraphsController < Projects::ApplicationController
...
@@ -23,7 +26,7 @@ class Projects::GraphsController < Projects::ApplicationController
private
private
def
fetch_graph
def
fetch_graph
@commits
=
@project
.
repository
.
commits
(
nil
,
nil
,
6000
,
0
,
true
)
@commits
=
@project
.
repository
.
commits
(
@ref
,
nil
,
6000
,
0
,
true
)
@log
=
[]
@log
=
[]
@commits
.
each
do
|
commit
|
@commits
.
each
do
|
commit
|
...
...
app/controllers/projects/refs_controller.rb
View file @
62c8bc22
...
@@ -8,17 +8,21 @@ class Projects::RefsController < Projects::ApplicationController
...
@@ -8,17 +8,21 @@ class Projects::RefsController < Projects::ApplicationController
def
switch
def
switch
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
new_path
=
if
params
[
:destination
]
==
"tree"
new_path
=
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
case
params
[
:destination
]
(
@id
))
when
"tree"
elsif
params
[
:destination
]
==
"blob"
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@id
)
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
when
"blob"
(
@id
))
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
@id
)
elsif
params
[
:destination
]
==
"graph"
when
"graph"
namespace_project_network_path
(
@project
.
namespace
,
@project
,
@id
,
@options
)
namespace_project_network_path
(
@project
.
namespace
,
@project
,
@id
,
@options
)
else
when
"graphs"
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@id
)
namespace_project_graph_path
(
@project
.
namespace
,
@project
,
@id
)
end
when
"graphs_commits"
commits_namespace_project_graph_path
(
@project
.
namespace
,
@project
,
@id
)
else
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@id
)
end
redirect_to
new_path
redirect_to
new_path
end
end
...
...
app/views/projects/graphs/commits.html.haml
View file @
62c8bc22
-
page_title
"Commit statistics"
-
page_title
"Commit statistics"
.tree-ref-holder
=
render
'shared/ref_switcher'
,
destination:
'graphs_commits'
=
render
'head'
=
render
'head'
%p
.lead
%p
.lead
Commit statistics for
Commit statistics for
%strong
#{
@re
pository
.
root_re
f
}
%strong
#{
@ref
}
#{
@commits_graph
.
start_date
.
strftime
(
'%b %d'
)
}
-
#{
@commits_graph
.
end_date
.
strftime
(
'%b %d'
)
}
#{
@commits_graph
.
start_date
.
strftime
(
'%b %d'
)
}
-
#{
@commits_graph
.
end_date
.
strftime
(
'%b %d'
)
}
.row
.row
...
...
app/views/projects/graphs/show.html.haml
View file @
62c8bc22
-
page_title
"Contributor statistics"
-
page_title
"Contributor statistics"
.tree-ref-holder
=
render
'shared/ref_switcher'
,
destination:
'graphs'
=
render
'head'
=
render
'head'
.loading-graph
.loading-graph
.center
.center
%h3
.page-title
%h3
.page-title
...
@@ -11,7 +14,7 @@
...
@@ -11,7 +14,7 @@
.header.clearfix
.header.clearfix
%h3
#date_header
.page-title
%h3
#date_header
.page-title
%p
.light
%p
.light
Commits to
#{
@
project
.
default_branch
}
, excluding merge commits. Limited by 6,000 commits
Commits to
#{
@
ref
}
, excluding merge commits. Limited by 6,000 commits
%input
#brush_change
{
:type
=>
"hidden"
}
%input
#brush_change
{
:type
=>
"hidden"
}
.graphs
.graphs
#contributors-master
#contributors-master
...
@@ -35,4 +38,3 @@
...
@@ -35,4 +38,3 @@
$(".stat-graph").fadeIn();
$(".stat-graph").fadeIn();
$(".loading-graph").hide();
$(".loading-graph").hide();
dataType: "json"
dataType: "json"
doc/api/README.md
View file @
62c8bc22
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
-
[
System Hooks
](
system_hooks.md
)
-
[
System Hooks
](
system_hooks.md
)
-
[
Groups
](
groups.md
)
-
[
Groups
](
groups.md
)
-
[
Namespaces
](
namespaces.md
)
-
[
Namespaces
](
namespaces.md
)
-
[
Settings
](
settings.md
)
## Clients
## Clients
...
...
doc/api/settings.md
0 → 100644
View file @
62c8bc22
# Application settings
This API allows you to read and modify GitLab instance application settings.
## Get current application settings:
```
GET /application/settings
```
```
json
{
"id"
:
1
,
"default_projects_limit"
:
10
,
"signup_enabled"
:
true
,
"signin_enabled"
:
true
,
"gravatar_enabled"
:
true
,
"sign_in_text"
:
""
,
"created_at"
:
"2015-06-12T15:51:55.432Z"
,
"updated_at"
:
"2015-06-30T13:22:42.210Z"
,
"home_page_url"
:
""
,
"default_branch_protection"
:
2
,
"twitter_sharing_enabled"
:
true
,
"restricted_visibility_levels"
:
[],
"max_attachment_size"
:
10
,
"session_expire_delay"
:
10080
,
"default_project_visibility"
:
0
,
"default_snippet_visibility"
:
0
,
"restricted_signup_domains"
:
[],
"user_oauth_applications"
:
true
,
"after_sign_out_path"
:
""
}
```
## Change application settings:
```
PUT /application/settings
```
Parameters:
-
`default_projects_limit`
- project limit per user
-
`signup_enabled`
- enable registration
-
`signin_enabled`
- enable login via GitLab account
-
`gravatar_enabled`
- enable gravatar
-
`sign_in_text`
- text on login page
-
`home_page_url`
- redirect to this URL when not logged in
-
`default_branch_protection`
- determine if developers can push to master
-
`twitter_sharing_enabled`
- allow users to share project creation in twitter
-
`restricted_visibility_levels`
- restrict certain visibility levels
-
`max_attachment_size`
- limit attachment size
-
`session_expire_delay`
- session lifetime
-
`default_project_visibility`
- what visibility level new project receives
-
`default_snippet_visibility`
- what visibility level new snippet receives
-
`restricted_signup_domains`
- force people to use only corporate emails for signup
-
`user_oauth_applications`
- allow users to create oauth applicaitons
-
`after_sign_out_path`
- where redirect user after logout
All parameters are optional. You can send only one that you want to change.
```
json
{
"id"
:
1
,
"default_projects_limit"
:
10
,
"signup_enabled"
:
true
,
"signin_enabled"
:
true
,
"gravatar_enabled"
:
true
,
"sign_in_text"
:
""
,
"created_at"
:
"2015-06-12T15:51:55.432Z"
,
"updated_at"
:
"2015-06-30T13:22:42.210Z"
,
"home_page_url"
:
""
,
"default_branch_protection"
:
2
,
"twitter_sharing_enabled"
:
true
,
"restricted_visibility_levels"
:
[],
"max_attachment_size"
:
10
,
"session_expire_delay"
:
10080
,
"default_project_visibility"
:
0
,
"default_snippet_visibility"
:
0
,
"restricted_signup_domains"
:
[],
"user_oauth_applications"
:
true
,
"after_sign_out_path"
:
""
}
```
doc/update/mysql_to_postgresql.md
View file @
62c8bc22
...
@@ -57,12 +57,15 @@ sudo -u git -H git clone https://github.com/gitlabhq/mysql-postgresql-converter.
...
@@ -57,12 +57,15 @@ sudo -u git -H git clone https://github.com/gitlabhq/mysql-postgresql-converter.
sudo -u git -H mkdir db
sudo -u git -H mkdir db
sudo -u git -H python mysql-postgresql-converter/db_converter.py gitlabhq_production.mysql db/database.sql
sudo -u git -H python mysql-postgresql-converter/db_converter.py gitlabhq_production.mysql db/database.sql
# Compress database backup
sudo -u git -H gzip db/database.sql
# Replace the MySQL dump in TIMESTAMP_gitlab_backup.tar.
# Replace the MySQL dump in TIMESTAMP_gitlab_backup.tar.
# Warning: if you forget to replace TIMESTAMP below, tar will create a new file
# Warning: if you forget to replace TIMESTAMP below, tar will create a new file
# 'TIMESTAMP_gitlab_backup.tar' without giving an error.
# 'TIMESTAMP_gitlab_backup.tar' without giving an error.
sudo -u git -H tar rf TIMESTAMP_gitlab_backup.tar db/database.sql
sudo -u git -H tar rf TIMESTAMP_gitlab_backup.tar db/database.sql
.gz
# Done! TIMESTAMP_gitlab_backup.tar can now be restored into a Postgres GitLab
# Done! TIMESTAMP_gitlab_backup.tar can now be restored into a Postgres GitLab
# installation. Remember to recreate the indexes after the import.
# installation. Remember to recreate the indexes after the import.
...
...
lib/api/api.rb
View file @
62c8bc22
...
@@ -49,5 +49,6 @@ module API
...
@@ -49,5 +49,6 @@ module API
mount
Namespaces
mount
Namespaces
mount
Branches
mount
Branches
mount
Labels
mount
Labels
mount
Settings
end
end
end
end
lib/api/entities.rb
View file @
62c8bc22
...
@@ -277,5 +277,27 @@ module API
...
@@ -277,5 +277,27 @@ module API
class
BroadcastMessage
<
Grape
::
Entity
class
BroadcastMessage
<
Grape
::
Entity
expose
:message
,
:starts_at
,
:ends_at
,
:color
,
:font
expose
:message
,
:starts_at
,
:ends_at
,
:color
,
:font
end
end
class
ApplicationSetting
<
Grape
::
Entity
expose
:id
expose
:default_projects_limit
expose
:signup_enabled
expose
:signin_enabled
expose
:gravatar_enabled
expose
:sign_in_text
expose
:created_at
expose
:updated_at
expose
:home_page_url
expose
:default_branch_protection
expose
:twitter_sharing_enabled
expose
:restricted_visibility_levels
expose
:max_attachment_size
expose
:session_expire_delay
expose
:default_project_visibility
expose
:default_snippet_visibility
expose
:restricted_signup_domains
expose
:user_oauth_applications
expose
:after_sign_out_path
end
end
end
end
end
lib/api/settings.rb
0 → 100644
View file @
62c8bc22
module
API
class
Settings
<
Grape
::
API
before
{
authenticated_as_admin!
}
helpers
do
def
current_settings
@current_setting
||=
(
ApplicationSetting
.
current
||
ApplicationSetting
.
create_from_defaults
)
end
end
# Get current applicaiton settings
#
# Example Request:
# GET /application/settings
get
"application/settings"
do
present
current_settings
,
with:
Entities
::
ApplicationSetting
end
# Modify applicaiton settings
#
# Example Request:
# PUT /application/settings
put
"application/settings"
do
attributes
=
current_settings
.
attributes
.
keys
-
[
"id"
]
attrs
=
attributes_for_keys
(
attributes
)
if
current_settings
.
update_attributes
(
attrs
)
present
current_settings
,
with:
Entities
::
ApplicationSetting
else
render_validation_error!
(
current_settings
)
end
end
end
end
lib/backup/database.rb
View file @
62c8bc22
...
@@ -22,9 +22,19 @@ module Backup
...
@@ -22,9 +22,19 @@ module Backup
end
end
report_success
(
success
)
report_success
(
success
)
abort
'Backup failed'
unless
success
abort
'Backup failed'
unless
success
$progress
.
print
'Compressing database ... '
success
=
system
(
'gzip'
,
db_file_name
)
report_success
(
success
)
abort
'Backup failed: compress error'
unless
success
end
end
def
restore
def
restore
$progress
.
print
'Decompressing database ... '
success
=
system
(
'gzip'
,
'-d'
,
db_file_name_gz
)
report_success
(
success
)
abort
'Restore failed: decompress error'
unless
success
success
=
case
config
[
"adapter"
]
success
=
case
config
[
"adapter"
]
when
/^mysql/
then
when
/^mysql/
then
$progress
.
print
"Restoring MySQL database
#{
config
[
'database'
]
}
... "
$progress
.
print
"Restoring MySQL database
#{
config
[
'database'
]
}
... "
...
@@ -48,6 +58,10 @@ module Backup
...
@@ -48,6 +58,10 @@ module Backup
File
.
join
(
db_dir
,
'database.sql'
)
File
.
join
(
db_dir
,
'database.sql'
)
end
end
def
db_file_name_gz
File
.
join
(
db_dir
,
'database.sql.gz'
)
end
def
mysql_args
def
mysql_args
args
=
{
args
=
{
'host'
=>
'--host'
,
'host'
=>
'--host'
,
...
...
spec/controllers/branches_controller_spec.rb
View file @
62c8bc22
...
@@ -55,4 +55,30 @@ describe Projects::BranchesController do
...
@@ -55,4 +55,30 @@ describe Projects::BranchesController do
it
{
is_expected
.
to
render_template
(
'new'
)
}
it
{
is_expected
.
to
render_template
(
'new'
)
}
end
end
end
end
describe
"POST destroy"
do
render_views
before
do
post
:destroy
,
format: :js
,
id:
branch
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
end
context
"valid branch name, valid source"
do
let
(
:branch
)
{
"feature"
}
it
{
expect
(
response
.
status
).
to
eq
(
200
)
}
it
{
expect
(
subject
).
to
render_template
(
'destroy'
)
}
end
context
"invalid branch name, valid ref"
do
let
(
:branch
)
{
"no-branch"
}
it
{
expect
(
response
.
status
).
to
eq
(
404
)
}
it
{
expect
(
subject
).
to
render_template
(
'destroy'
)
}
end
end
end
end
spec/requests/api/settings_spec.rb
0 → 100644
View file @
62c8bc22
require
'spec_helper'
describe
API
::
API
,
'Settings'
,
api:
true
do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
describe
"GET /application/settings"
do
it
"should return application settings"
do
get
api
(
"/application/settings"
,
admin
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Hash
expect
(
json_response
[
'default_projects_limit'
]).
to
eq
(
42
)
expect
(
json_response
[
'signin_enabled'
]).
to
be_truthy
end
end
describe
"PUT /application/settings"
do
it
"should update application settings"
do
put
api
(
"/application/settings"
,
admin
),
default_projects_limit:
3
,
signin_enabled:
false
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'default_projects_limit'
]).
to
eq
(
3
)
expect
(
json_response
[
'signin_enabled'
]).
to
be_falsey
end
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