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
Jérome Perrin
gitlab-ce
Commits
b96d049e
Commit
b96d049e
authored
Mar 18, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into issue_3400_port
parents
3898bffd
18fc7c66
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
110 additions
and
103 deletions
+110
-103
CHANGELOG
CHANGELOG
+1
-0
app/assets/stylesheets/framework/lists.scss
app/assets/stylesheets/framework/lists.scss
+5
-2
app/assets/stylesheets/framework/variables.scss
app/assets/stylesheets/framework/variables.scss
+16
-15
app/assets/stylesheets/pages/commits.scss
app/assets/stylesheets/pages/commits.scss
+1
-1
app/assets/stylesheets/pages/events.scss
app/assets/stylesheets/pages/events.scss
+2
-6
app/assets/stylesheets/pages/issues.scss
app/assets/stylesheets/pages/issues.scss
+1
-1
app/assets/stylesheets/pages/todos.scss
app/assets/stylesheets/pages/todos.scss
+0
-18
app/assets/stylesheets/pages/tree.scss
app/assets/stylesheets/pages/tree.scss
+1
-1
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+9
-2
app/helpers/labels_helper.rb
app/helpers/labels_helper.rb
+0
-8
app/helpers/milestones_helper.rb
app/helpers/milestones_helper.rb
+0
-13
app/models/merge_request.rb
app/models/merge_request.rb
+4
-1
app/services/projects/housekeeping_service.rb
app/services/projects/housekeeping_service.rb
+1
-1
app/views/dashboard/todos/_todo.html.haml
app/views/dashboard/todos/_todo.html.haml
+1
-1
app/views/dashboard/todos/index.html.haml
app/views/dashboard/todos/index.html.haml
+1
-1
app/views/projects/issues/_issue.html.haml
app/views/projects/issues/_issue.html.haml
+3
-3
app/views/projects/merge_requests/_merge_request.html.haml
app/views/projects/merge_requests/_merge_request.html.haml
+3
-3
app/views/shared/groups/_group.html.haml
app/views/shared/groups/_group.html.haml
+7
-6
app/views/shared/projects/_project.html.haml
app/views/shared/projects/_project.html.haml
+18
-16
app/views/shared/snippets/_snippet.html.haml
app/views/shared/snippets/_snippet.html.haml
+2
-2
app/workers/gitlab_shell_one_shot_worker.rb
app/workers/gitlab_shell_one_shot_worker.rb
+10
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+22
-0
spec/services/projects/housekeeping_service_spec.rb
spec/services/projects/housekeeping_service_spec.rb
+2
-2
No files found.
CHANGELOG
View file @
b96d049e
...
@@ -43,6 +43,7 @@ v 8.6.0 (unreleased)
...
@@ -43,6 +43,7 @@ v 8.6.0 (unreleased)
- Increase the notes polling timeout over time (Roberto Dip)
- Increase the notes polling timeout over time (Roberto Dip)
- Add shortcut to toggle markdown preview (Florent Baldino)
- Add shortcut to toggle markdown preview (Florent Baldino)
- Show labels in dashboard and group milestone views
- Show labels in dashboard and group milestone views
- Fix an issue when the target branch of a MR had been deleted
- Add main language of a project in the list of projects (Tiago Botelho)
- Add main language of a project in the list of projects (Tiago Botelho)
- Add #upcoming filter to Milestone filter (Tiago Botelho)
- Add #upcoming filter to Milestone filter (Tiago Botelho)
- Add ability to show archived projects on dashboard, explore and group pages
- Add ability to show archived projects on dashboard, explore and group pages
...
...
app/assets/stylesheets/framework/lists.scss
View file @
b96d049e
...
@@ -111,14 +111,17 @@ ul.content-list {
...
@@ -111,14 +111,17 @@ ul.content-list {
>
li
{
>
li
{
border-color
:
$table-border-color
;
border-color
:
$table-border-color
;
color
:
$list-text-color
;
font-size
:
$list-font-size
;
font-size
:
$list-font-size
;
color
:
$list-text-color
;
.title
{
.title
{
color
:
$list-title-color
;
font-weight
:
600
;
font-weight
:
600
;
}
}
a
{
color
:
$gl-dark-link-color
;
}
.description
{
.description
{
p
{
p
{
@include
str-truncated
;
@include
str-truncated
;
...
...
app/assets/stylesheets/framework/variables.scss
View file @
b96d049e
...
@@ -10,36 +10,37 @@ $gutter_inner_width: 258px;
...
@@ -10,36 +10,37 @@ $gutter_inner_width: 258px;
/*
/*
* UI elements
* UI elements
*/
*/
$border-color
:
#efeff1
;
$border-color
:
#efeff1
;
$table-border-color
:
#eef0f2
;
$table-border-color
:
#eef0f2
;
$background-color
:
#faf9f9
;
$background-color
:
#faf9f9
;
/*
/*
* Text
* Text
*/
*/
$gl-font-size
:
15px
;
$gl-font-size
:
15px
;
$gl-title-color
:
#333
;
$gl-title-color
:
#333
;
$gl-text-color
:
#555
;
$gl-text-color
:
#555
;
$gl-text-green
:
#4a2
;
$gl-text-red
:
#d12f19
;
$gl-text-orange
:
#d90
;
$gl-link-color
:
#3084bb
;
$gl-dark-link-color
:
#333
;
$gl-placeholder-color
:
#8f8f8f
;
$gl-placeholder-color
:
#8f8f8f
;
$gl-text-green
:
#4a2
;
$gl-gray
:
$gl-text-color
;
$gl-text-red
:
#d12f19
;
$gl-header-color
:
$gl-title-color
;
$gl-text-orange
:
#d90
;
$gl-header-color
:
$gl-title-color
;
$gl-link-color
:
#333c48
;
$gl-gray
:
$gl-text-color
;
/*
/*
* Lists
* Lists
*/
*/
$list-font-size
:
$gl-font-size
;
$list-font-size
:
$gl-font-size
;
$list-title-color
:
$gl-title-color
;
$list-title-color
:
$gl-title-color
;
$list-text-color
:
$gl-text-color
;
$list-text-color
:
$gl-text-color
;
/*
/*
* Markdown
* Markdown
*/
*/
$md-text-color
:
#444
;
$md-text-color
:
$gl-text-color
;
$md-link-color
:
#3084bb
;
$md-link-color
:
$gl-link-color
;
/*
/*
* Code
* Code
...
...
app/assets/stylesheets/pages/commits.scss
View file @
b96d049e
...
@@ -55,7 +55,7 @@ li.commit {
...
@@ -55,7 +55,7 @@ li.commit {
}
}
.commit-row-message
{
.commit-row-message
{
color
:
$gl-link-color
;
color
:
$gl-
dark-
link-color
;
&
:hover
{
&
:hover
{
text-decoration
:
underline
;
text-decoration
:
underline
;
...
...
app/assets/stylesheets/pages/events.scss
View file @
b96d049e
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
}
}
a
{
a
{
color
:
#4c4e54
;
color
:
$gl-dark-link-color
;
}
}
.avatar
{
.avatar
{
...
@@ -31,11 +31,7 @@
...
@@ -31,11 +31,7 @@
.event-title
{
.event-title
{
@include
str-truncated
(
calc
(
100%
-
174px
));
@include
str-truncated
(
calc
(
100%
-
174px
));
font-weight
:
600
;
font-weight
:
600
;
color
:
$list-title-color
;
color
:
$list-text-color
;
a
{
color
:
$list-title-color
;
}
}
}
.event-body
{
.event-body
{
...
...
app/assets/stylesheets/pages/issues.scss
View file @
b96d049e
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
padding
:
10px
$gl-padding
;
padding
:
10px
$gl-padding
;
position
:
relative
;
position
:
relative
;
.
issue-
title
{
.title
{
margin-bottom
:
2px
;
margin-bottom
:
2px
;
}
}
...
...
app/assets/stylesheets/pages/todos.scss
View file @
b96d049e
...
@@ -14,26 +14,8 @@
...
@@ -14,26 +14,8 @@
}
}
.todo-item
{
.todo-item
{
font-size
:
$gl-font-size
;
padding-left
:
$gl-avatar-size
+
$gl-padding-top
;
color
:
$gl-text-color
;
a
{
color
:
#4c4e54
;
}
.avatar
{
margin-left
:
-
(
$gl-avatar-size
+
$gl-padding-top
);
}
.todo-title
{
.todo-title
{
@include
str-truncated
(
calc
(
100%
-
174px
));
@include
str-truncated
(
calc
(
100%
-
174px
));
font-weight
:
600
;
color
:
$list-title-color
;
a
{
color
:
$list-title-color
;
}
}
}
.todo-body
{
.todo-body
{
...
...
app/assets/stylesheets/pages/tree.scss
View file @
b96d049e
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
vertical-align
:
middle
;
vertical-align
:
middle
;
i
,
a
{
i
,
a
{
color
:
$gl-link-color
;
color
:
$gl-
dark-
link-color
;
}
}
img
{
img
{
...
...
app/controllers/dashboard_controller.rb
View file @
b96d049e
...
@@ -21,17 +21,24 @@ class DashboardController < Dashboard::ApplicationController
...
@@ -21,17 +21,24 @@ class DashboardController < Dashboard::ApplicationController
end
end
def
labels
def
labels
labels
=
Label
.
where
(
project_id:
@projects
).
select
(
:title
,
:color
).
uniq
(
:title
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
json
do
format
.
json
do
render
json:
view_context
.
projects_labels_option
s
render
json:
label
s
end
end
end
end
end
end
def
milestones
def
milestones
milestones
=
Milestone
.
where
(
project_id:
@projects
).
active
epoch
=
DateTime
.
parse
(
'1970-01-01'
)
grouped_milestones
=
GlobalMilestone
.
build_collection
(
milestones
)
grouped_milestones
=
grouped_milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
json
do
format
.
json
do
render
json:
view_context
.
projects_milestones_option
s
render
json:
grouped_milestone
s
end
end
end
end
end
end
...
...
app/helpers/labels_helper.rb
View file @
b96d049e
...
@@ -109,14 +109,6 @@ module LabelsHelper
...
@@ -109,14 +109,6 @@ module LabelsHelper
end
end
end
end
def
projects_labels_options
if
@project
@project
.
labels
else
Label
.
where
(
project_id:
@projects
)
end
end
def
labels_filter_path
def
labels_filter_path
if
@project
if
@project
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
...
...
app/helpers/milestones_helper.rb
View file @
b96d049e
...
@@ -46,19 +46,6 @@ module MilestonesHelper
...
@@ -46,19 +46,6 @@ module MilestonesHelper
end
end
end
end
def
projects_milestones_options
milestones
=
if
@project
@project
.
milestones
else
Milestone
.
where
(
project_id:
@projects
)
end
.
active
epoch
=
DateTime
.
parse
(
'1970-01-01'
)
grouped_milestones
=
GlobalMilestone
.
build_collection
(
milestones
)
grouped_milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
end
def
milestones_filter_dropdown_path
def
milestones_filter_dropdown_path
if
@project
if
@project
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
)
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
)
...
...
app/models/merge_request.rb
View file @
b96d049e
...
@@ -516,7 +516,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -516,7 +516,7 @@ class MergeRequest < ActiveRecord::Base
end
end
def
target_sha
def
target_sha
@target_sha
||=
target_project
.
repository
.
commit
(
target_branch
).
sha
@target_sha
||=
target_project
.
repository
.
commit
(
target_branch
).
try
(
:sha
)
end
end
def
source_sha
def
source_sha
...
@@ -572,8 +572,11 @@ class MergeRequest < ActiveRecord::Base
...
@@ -572,8 +572,11 @@ class MergeRequest < ActiveRecord::Base
end
end
def
compute_diverged_commits_count
def
compute_diverged_commits_count
return
0
unless
source_sha
&&
target_sha
Gitlab
::
Git
::
Commit
.
between
(
target_project
.
repository
.
raw_repository
,
source_sha
,
target_sha
).
size
Gitlab
::
Git
::
Commit
.
between
(
target_project
.
repository
.
raw_repository
,
source_sha
,
target_sha
).
size
end
end
private
:compute_diverged_commits_count
def
diverged_from_target_branch?
def
diverged_from_target_branch?
diverged_commits_count
>
0
diverged_commits_count
>
0
...
...
app/services/projects/housekeeping_service.rb
View file @
b96d049e
...
@@ -24,7 +24,7 @@ module Projects
...
@@ -24,7 +24,7 @@ module Projects
def
execute
def
execute
raise
LeaseTaken
if
!
try_obtain_lease
raise
LeaseTaken
if
!
try_obtain_lease
GitlabShellWorker
.
perform_async
(
:gc
,
@project
.
path_with_namespace
)
GitlabShell
OneShot
Worker
.
perform_async
(
:gc
,
@project
.
path_with_namespace
)
ensure
ensure
@project
.
update_column
(
:pushes_since_gc
,
0
)
@project
.
update_column
(
:pushes_since_gc
,
0
)
end
end
...
...
app/views/dashboard/todos/_todo.html.haml
View file @
b96d049e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
.todo-item.todo-block
.todo-item.todo-block
=
image_tag
avatar_icon
(
todo
.
author_email
,
40
),
class:
'avatar s40'
,
alt
:''
=
image_tag
avatar_icon
(
todo
.
author_email
,
40
),
class:
'avatar s40'
,
alt
:''
.todo-title
.todo-title
.title
%span
.author-name
%span
.author-name
-
if
todo
.
author
-
if
todo
.
author
=
link_to_author
(
todo
)
=
link_to_author
(
todo
)
...
...
app/views/dashboard/todos/index.html.haml
View file @
b96d049e
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
.panel-heading
.panel-heading
=
link_to
project
.
name_with_namespace
,
namespace_project_path
(
project
.
namespace
,
project
)
=
link_to
project
.
name_with_namespace
,
namespace_project_path
(
project
.
namespace
,
project
)
%ul
.
well
-list.todos-list
%ul
.
content
-list.todos-list
=
render
group
[
1
]
=
render
group
[
1
]
=
paginate
@todos
,
theme:
"gitlab"
=
paginate
@todos
,
theme:
"gitlab"
-
else
-
else
...
...
app/views/projects/issues/_issue.html.haml
View file @
b96d049e
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
.issue-check
.issue-check
=
check_box_tag
dom_id
(
issue
,
"selected"
),
nil
,
false
,
'data-id'
=>
issue
.
id
,
class:
"selected_issue"
=
check_box_tag
dom_id
(
issue
,
"selected"
),
nil
,
false
,
'data-id'
=>
issue
.
id
,
class:
"selected_issue"
.issue-title
.issue-title
.title
%span
.issue-title-text
%span
.issue-title-text
=
confidential_icon
(
issue
)
=
confidential_icon
(
issue
)
=
link_to_gfm
issue
.
title
,
issue_path
(
issue
)
,
class:
"title"
=
link_to_gfm
issue
.
title
,
issue_path
(
issue
)
%ul
.controls
.light
%ul
.controls
-
if
issue
.
closed?
-
if
issue
.
closed?
%li
%li
CLOSED
CLOSED
...
...
app/views/projects/merge_requests/_merge_request.html.haml
View file @
b96d049e
%li
{
class:
mr_css_classes
(
merge_request
)
}
%li
{
class:
mr_css_classes
(
merge_request
)
}
.merge-request-title
.merge-request-title
.title
%span
.merge-request-title-text
%span
.merge-request-title-text
=
link_to_gfm
merge_request
.
title
,
merge_request_path
(
merge_request
)
,
class:
"title"
=
link_to_gfm
merge_request
.
title
,
merge_request_path
(
merge_request
)
%ul
.controls
.light
%ul
.controls
-
if
merge_request
.
merged?
-
if
merge_request
.
merged?
%li
%li
MERGED
MERGED
...
...
app/views/shared/groups/_group.html.haml
View file @
b96d049e
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
%i
.fa.fa-cogs
%i
.fa.fa-cogs
=
link_to
leave_group_group_members_path
(
group
),
data:
{
confirm:
leave_group_message
(
group
.
name
)
},
method: :delete
,
class:
"btn-sm btn btn-grouped"
,
title:
'Leave this group'
do
=
link_to
leave_group_group_members_path
(
group
),
data:
{
confirm:
leave_group_message
(
group
.
name
)
},
method: :delete
,
class:
"btn-sm btn btn-grouped"
,
title:
'Leave this group'
do
%i
.fa.fa-sign-out
=
icon
(
'sign-out'
)
.stats
.stats
%span
%span
...
@@ -22,12 +22,13 @@
...
@@ -22,12 +22,13 @@
=
number_with_delimiter
(
group
.
users
.
count
)
=
number_with_delimiter
(
group
.
users
.
count
)
=
image_tag
group_icon
(
group
),
class:
"avatar s40 hidden-xs"
=
image_tag
group_icon
(
group
),
class:
"avatar s40 hidden-xs"
=
link_to
group
,
class:
'group-name title'
do
.title
=
group
.
name
=
link_to
group
,
class:
'group-name'
do
=
group
.
name
-
if
group_member
-
if
group_member
as
as
%span
#{
group_member
.
human_access
}
%span
#{
group_member
.
human_access
}
-
if
group
.
description
.
present?
-
if
group
.
description
.
present?
.description
.description
...
...
app/views/shared/projects/_project.html.haml
View file @
b96d049e
...
@@ -7,26 +7,11 @@
...
@@ -7,26 +7,11 @@
-
show_last_commit_as_description
=
false
unless
local_assigns
[
:show_last_commit_as_description
]
==
true
&&
project
.
commit
-
show_last_commit_as_description
=
false
unless
local_assigns
[
:show_last_commit_as_description
]
==
true
&&
project
.
commit
-
css_class
+=
" no-description"
if
project
.
description
.
blank?
&&
!
show_last_commit_as_description
-
css_class
+=
" no-description"
if
project
.
description
.
blank?
&&
!
show_last_commit_as_description
-
ci_commit
=
project
.
ci_commit
(
project
.
commit
.
sha
)
if
ci
&&
!
project
.
empty_repo?
&&
project
.
commit
-
ci_commit
=
project
.
ci_commit
(
project
.
commit
.
sha
)
if
ci
&&
!
project
.
empty_repo?
&&
project
.
commit
-
cache_key
=
[
project
.
namespace
,
project
,
controller
.
controller_name
,
controller
.
action_name
,
current_application_settings
,
'v2.
2
'
]
-
cache_key
=
[
project
.
namespace
,
project
,
controller
.
controller_name
,
controller
.
action_name
,
current_application_settings
,
'v2.
3
'
]
-
cache_key
.
push
(
ci_commit
.
status
)
if
ci_commit
-
cache_key
.
push
(
ci_commit
.
status
)
if
ci_commit
%li
.project-row
{
class:
css_class
}
%li
.project-row
{
class:
css_class
}
=
cache
(
cache_key
)
do
=
cache
(
cache_key
)
do
=
link_to
project_path
(
project
),
class:
dom_class
(
project
)
do
-
if
avatar
.dash-project-avatar
-
if
use_creator_avatar
=
image_tag
avatar_icon
(
project
.
creator
.
email
,
40
),
class:
"avatar s40"
,
alt
:''
-
else
=
project_icon
(
project
,
alt:
''
,
class:
'avatar project-avatar s40'
)
%span
.project-full-name.title
%span
.namespace-name
-
if
project
.
namespace
&&
!
skip_namespace
=
project
.
namespace
.
human_name
\/
%span
.project-name.filter-title
=
project
.
name
.controls
.controls
-
if
project
.
main_language
-
if
project
.
main_language
%span
%span
...
@@ -45,6 +30,23 @@
...
@@ -45,6 +30,23 @@
%span
.visibility-icon.has_tooltip
{
data:
{
container:
'body'
,
placement:
'left'
},
%span
.visibility-icon.has_tooltip
{
data:
{
container:
'body'
,
placement:
'left'
},
title:
"#{visibility_level_label(project.visibility_level)} - #{project_visibility_level_description(project.visibility_level)}"
}
title:
"#{visibility_level_label(project.visibility_level)} - #{project_visibility_level_description(project.visibility_level)}"
}
=
visibility_level_icon
(
project
.
visibility_level
,
fw:
false
)
=
visibility_level_icon
(
project
.
visibility_level
,
fw:
false
)
.title
=
link_to
project_path
(
project
),
class:
dom_class
(
project
)
do
-
if
avatar
.dash-project-avatar
-
if
use_creator_avatar
=
image_tag
avatar_icon
(
project
.
creator
.
email
,
40
),
class:
"avatar s40"
,
alt
:''
-
else
=
project_icon
(
project
,
alt:
''
,
class:
'avatar project-avatar s40'
)
%span
.project-full-name
%span
.namespace-name
-
if
project
.
namespace
&&
!
skip_namespace
=
project
.
namespace
.
human_name
\/
%span
.project-name.filter-title
=
project
.
name
-
if
show_last_commit_as_description
-
if
show_last_commit_as_description
.description
.description
=
link_to_gfm
project
.
commit
.
title
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
project
.
commit
),
=
link_to_gfm
project
.
commit
.
title
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
project
.
commit
),
...
...
app/views/shared/snippets/_snippet.html.haml
View file @
b96d049e
%li
.snippet-row
%li
.snippet-row
=
image_tag
avatar_icon
(
snippet
.
author_email
),
class:
"avatar s40 hidden-xs"
,
alt:
''
=
image_tag
avatar_icon
(
snippet
.
author_email
),
class:
"avatar s40 hidden-xs"
,
alt:
''
.
snippet-
title
.title
=
link_to
reliable_snippet_path
(
snippet
)
,
class:
'title'
do
=
link_to
reliable_snippet_path
(
snippet
)
do
=
truncate
(
snippet
.
title
,
length:
60
)
=
truncate
(
snippet
.
title
,
length:
60
)
-
if
snippet
.
private?
-
if
snippet
.
private?
%span
.label.label-gray
%span
.label.label-gray
...
...
app/workers/gitlab_shell_one_shot_worker.rb
0 → 100644
View file @
b96d049e
class
GitlabShellOneShotWorker
include
Sidekiq
::
Worker
include
Gitlab
::
ShellAdapter
sidekiq_options
queue: :gitlab_shell
,
retry:
false
def
perform
(
action
,
*
arg
)
gitlab_shell
.
send
(
action
,
*
arg
)
end
end
spec/models/merge_request_spec.rb
View file @
b96d049e
...
@@ -86,6 +86,16 @@ describe MergeRequest, models: true do
...
@@ -86,6 +86,16 @@ describe MergeRequest, models: true do
end
end
end
end
describe
'#target_sha'
do
context
'when the target branch does not exist anymore'
do
subject
{
create
(
:merge_request
).
tap
{
|
mr
|
mr
.
update_attribute
(
:target_branch
,
'deleted'
)
}
}
it
'returns nil'
do
expect
(
subject
.
target_sha
).
to
be_nil
end
end
end
describe
'#source_sha'
do
describe
'#source_sha'
do
let
(
:last_branch_commit
)
{
subject
.
source_project
.
repository
.
commit
(
subject
.
source_branch
)
}
let
(
:last_branch_commit
)
{
subject
.
source_project
.
repository
.
commit
(
subject
.
source_branch
)
}
...
@@ -310,6 +320,18 @@ describe MergeRequest, models: true do
...
@@ -310,6 +320,18 @@ describe MergeRequest, models: true do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
context
'when the target branch does not exist anymore'
do
subject
{
create
(
:merge_request
).
tap
{
|
mr
|
mr
.
update_attribute
(
:target_branch
,
'deleted'
)
}
}
it
'does not crash'
do
expect
{
subject
.
diverged_commits_count
}.
not_to
raise_error
end
it
'returns 0'
do
expect
(
subject
.
diverged_commits_count
).
to
eq
(
0
)
end
end
context
'diverged on same repository'
do
context
'diverged on same repository'
do
subject
(
:merge_request_with_divergence
)
{
create
(
:merge_request
,
:diverged
,
source_project:
project
,
target_project:
project
)
}
subject
(
:merge_request_with_divergence
)
{
create
(
:merge_request
,
:diverged
,
source_project:
project
,
target_project:
project
)
}
...
...
spec/services/projects/housekeeping_service_spec.rb
View file @
b96d049e
...
@@ -12,7 +12,7 @@ describe Projects::HousekeepingService do
...
@@ -12,7 +12,7 @@ describe Projects::HousekeepingService do
it
'enqueues a sidekiq job'
do
it
'enqueues a sidekiq job'
do
expect
(
subject
).
to
receive
(
:try_obtain_lease
).
and_return
(
true
)
expect
(
subject
).
to
receive
(
:try_obtain_lease
).
and_return
(
true
)
expect
(
GitlabShellWorker
).
to
receive
(
:perform_async
).
with
(
:gc
,
project
.
path_with_namespace
)
expect
(
GitlabShell
OneShot
Worker
).
to
receive
(
:perform_async
).
with
(
:gc
,
project
.
path_with_namespace
)
subject
.
execute
subject
.
execute
expect
(
project
.
pushes_since_gc
).
to
eq
(
0
)
expect
(
project
.
pushes_since_gc
).
to
eq
(
0
)
...
@@ -20,7 +20,7 @@ describe Projects::HousekeepingService do
...
@@ -20,7 +20,7 @@ describe Projects::HousekeepingService do
it
'does not enqueue a job when no lease can be obtained'
do
it
'does not enqueue a job when no lease can be obtained'
do
expect
(
subject
).
to
receive
(
:try_obtain_lease
).
and_return
(
false
)
expect
(
subject
).
to
receive
(
:try_obtain_lease
).
and_return
(
false
)
expect
(
GitlabShellWorker
).
not_to
receive
(
:perform_async
)
expect
(
GitlabShell
OneShot
Worker
).
not_to
receive
(
:perform_async
)
expect
{
subject
.
execute
}.
to
raise_error
(
Projects
::
HousekeepingService
::
LeaseTaken
)
expect
{
subject
.
execute
}.
to
raise_error
(
Projects
::
HousekeepingService
::
LeaseTaken
)
expect
(
project
.
pushes_since_gc
).
to
eq
(
0
)
expect
(
project
.
pushes_since_gc
).
to
eq
(
0
)
...
...
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