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
9694c816
Commit
9694c816
authored
May 11, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
f1ba3769
e1a8089c
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
63 additions
and
37 deletions
+63
-37
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/compare_controller.rb
app/controllers/projects/compare_controller.rb
+2
-1
app/controllers/uploads_controller.rb
app/controllers/uploads_controller.rb
+5
-5
app/helpers/compare_helper.rb
app/helpers/compare_helper.rb
+12
-13
app/views/events/event/_push.html.haml
app/views/events/event/_push.html.haml
+13
-1
app/views/projects/branches/_branch.html.haml
app/views/projects/branches/_branch.html.haml
+7
-4
app/views/projects/commits/_head.html.haml
app/views/projects/commits/_head.html.haml
+1
-1
app/views/projects/commits/show.html.haml
app/views/projects/commits/show.html.haml
+11
-5
app/views/projects/compare/_form.html.haml
app/views/projects/compare/_form.html.haml
+4
-3
doc/development/migration_style_guide.md
doc/development/migration_style_guide.md
+6
-3
features/steps/project/commits/commits.rb
features/steps/project/commits/commits.rb
+1
-1
No files found.
CHANGELOG
View file @
9694c816
...
@@ -50,6 +50,7 @@ v 7.11.0 (unreleased)
...
@@ -50,6 +50,7 @@ v 7.11.0 (unreleased)
- Add footnotes support to Markdown (Guillaume Delbergue)
- Add footnotes support to Markdown (Guillaume Delbergue)
- Add current_sign_in_at to UserFull REST api.
- Add current_sign_in_at to UserFull REST api.
- Make Sidekiq MemoryKiller shutdown signal configurable
- Make Sidekiq MemoryKiller shutdown signal configurable
- Add "Create Merge Request" buttons to commits and branches pages and push event.
v 7.10.2
v 7.10.2
- Fix CI links on MR page
- Fix CI links on MR page
...
...
app/controllers/projects/compare_controller.rb
View file @
9694c816
...
@@ -6,11 +6,12 @@ class Projects::CompareController < Projects::ApplicationController
...
@@ -6,11 +6,12 @@ class Projects::CompareController < Projects::ApplicationController
before_action
:authorize_download_code!
before_action
:authorize_download_code!
def
index
def
index
@ref
=
Addressable
::
URI
.
unescape
(
params
[
:to
])
end
end
def
show
def
show
base_ref
=
Addressable
::
URI
.
unescape
(
params
[
:from
])
base_ref
=
Addressable
::
URI
.
unescape
(
params
[
:from
])
head_ref
=
Addressable
::
URI
.
unescape
(
params
[
:to
])
@ref
=
head_ref
=
Addressable
::
URI
.
unescape
(
params
[
:to
])
compare_result
=
CompareService
.
new
.
execute
(
compare_result
=
CompareService
.
new
.
execute
(
current_user
,
current_user
,
...
...
app/controllers/uploads_controller.rb
View file @
9694c816
...
@@ -52,13 +52,13 @@ class UploadsController < ApplicationController
...
@@ -52,13 +52,13 @@ class UploadsController < ApplicationController
def
upload_model
def
upload_model
upload_models
=
{
upload_models
=
{
user:
User
,
"user"
=>
User
,
project:
Project
,
"project"
=>
Project
,
note:
Note
,
"note"
=>
Note
,
group:
Group
"group"
=>
Group
}
}
upload_models
[
params
[
:model
]
.
to_sym
]
upload_models
[
params
[
:model
]]
end
end
def
upload_mount
def
upload_mount
...
...
app/helpers/compare_helper.rb
View file @
9694c816
module
CompareHelper
module
CompareHelper
def
compare_to_mr_button?
def
create_mr_button?
(
from
=
params
[
:from
],
to
=
params
[
:to
],
project
=
@project
)
@project
.
merge_requests_enabled
&&
from
.
present?
&&
params
[
:from
].
present?
&&
to
.
present?
&&
params
[
:to
].
present?
&&
from
!=
to
&&
@repository
.
branch_names
.
include?
(
params
[
:from
])
&&
project
.
merge_requests_enabled
&&
@repository
.
branch_names
.
include?
(
params
[
:to
])
&&
project
.
repository
.
branch_names
.
include?
(
from
)
&&
params
[
:from
]
!=
params
[
:to
]
&&
project
.
repository
.
branch_names
.
include?
(
to
)
!
@refs_are_same
end
end
def
c
ompare_mr_path
def
c
reate_mr_path
(
from
=
params
[
:from
],
to
=
params
[
:to
],
project
=
@project
)
new_namespace_project_merge_request_path
(
new_namespace_project_merge_request_path
(
@
project
.
namespace
,
project
.
namespace
,
@
project
,
project
,
merge_request:
{
merge_request:
{
source_branch:
params
[
:to
]
,
source_branch:
to
,
target_branch:
params
[
:from
]
target_branch:
from
}
}
)
)
end
end
...
...
app/views/events/event/_push.html.haml
View file @
9694c816
...
@@ -17,15 +17,27 @@
...
@@ -17,15 +17,27 @@
-
few_commits
.
each
do
|
commit
|
-
few_commits
.
each
do
|
commit
|
=
render
"events/commit"
,
commit:
commit
,
project:
project
=
render
"events/commit"
,
commit:
commit
,
project:
project
-
create_mr
=
current_user
==
event
.
author
&&
event
.
new_ref?
&&
create_mr_button?
(
event
.
project
.
default_branch
,
event
.
ref_name
,
event
.
project
)
-
if
event
.
commits_count
>
1
-
if
event
.
commits_count
>
1
%li
.commits-stat
%li
.commits-stat
-
if
event
.
commits_count
>
2
-
if
event
.
commits_count
>
2
%span
... and
#{
event
.
commits_count
-
2
}
more commits.
%span
... and
#{
event
.
commits_count
-
2
}
more commits.
-
if
event
.
md_ref?
-
if
event
.
md_ref?
-
from
=
event
.
commit_from
-
from
=
event
.
commit_from
-
from_label
=
truncate_sha
(
from
)
-
from_label
=
truncate_sha
(
from
)
-
else
-
else
-
from
=
event
.
project
.
default_branch
-
from
=
event
.
project
.
default_branch
-
from_label
=
from
-
from_label
=
from
=
link_to
namespace_project_compare_path
(
event
.
project
.
namespace
,
event
.
project
,
from:
from
,
to:
event
.
commit_to
)
do
=
link_to
namespace_project_compare_path
(
event
.
project
.
namespace
,
event
.
project
,
from:
from
,
to:
event
.
commit_to
)
do
%strong
Compare
→
#{
from_label
}
...
#{
truncate_sha
(
event
.
commit_to
)
}
Compare
#{
from_label
}
...
#{
truncate_sha
(
event
.
commit_to
)
}
-
if
create_mr
or
=
link_to
create_mr_path
(
event
.
project
.
default_branch
,
event
.
ref_name
,
event
.
project
)
do
create a merge request
-
elsif
create_mr
%li
.commits-stat
=
link_to
create_mr_path
(
event
.
project
.
default_branch
,
event
.
ref_name
,
event
.
project
)
do
Create Merge Request
app/views/projects/branches/_branch.html.haml
View file @
9694c816
...
@@ -10,16 +10,19 @@
...
@@ -10,16 +10,19 @@
%i
.fa.fa-lock
%i
.fa.fa-lock
protected
protected
.pull-right
.pull-right
-
if
can?
(
current_user
,
:download_code
,
@project
)
-
if
create_mr_button?
(
@repository
.
root_ref
,
branch
.
name
)
=
render
'projects/repositories/download_archive'
,
ref:
branch
.
name
,
btn_class:
'btn-grouped btn-group-xs'
=
link_to
create_mr_path
(
@repository
.
root_ref
,
branch
.
name
),
class:
'btn btn-grouped btn-xs'
do
=
icon
(
'plus'
)
Merge Request
-
if
branch
.
name
!=
@repository
.
root_ref
-
if
branch
.
name
!=
@repository
.
root_ref
=
link_to
namespace_project_compare_index_path
(
@project
.
namespace
,
@project
,
from:
@repository
.
root_ref
,
to:
branch
.
name
),
class:
'btn btn-grouped btn-xs'
,
method: :post
,
title:
"Compare"
do
=
link_to
namespace_project_compare_index_path
(
@project
.
namespace
,
@project
,
from:
@repository
.
root_ref
,
to:
branch
.
name
),
class:
'btn btn-grouped btn-xs'
,
method: :post
,
title:
"Compare"
do
%i
.fa.fa-files-o
=
icon
(
"exchange"
)
Compare
Compare
-
if
can_remove_branch?
(
@project
,
branch
.
name
)
-
if
can_remove_branch?
(
@project
,
branch
.
name
)
=
link_to
namespace_project_branch_path
(
@project
.
namespace
,
@project
,
branch
.
name
),
class:
'btn btn-grouped btn-xs btn-remove remove-row'
,
method: :delete
,
data:
{
confirm:
'Removed branch cannot be restored. Are you sure?'
},
remote:
true
do
=
link_to
namespace_project_branch_path
(
@project
.
namespace
,
@project
,
branch
.
name
),
class:
'btn btn-grouped btn-xs btn-remove remove-row'
,
method: :delete
,
data:
{
confirm:
'Removed branch cannot be restored. Are you sure?'
},
remote:
true
do
%i
.fa.fa-trash-o
=
icon
(
"trash-o"
)
-
if
commit
-
if
commit
%ul
.list-unstyled
%ul
.list-unstyled
...
...
app/views/projects/commits/_head.html.haml
View file @
9694c816
%ul
.nav.nav-tabs
%ul
.nav.nav-tabs
=
nav_link
(
controller:
[
:commit
,
:commits
])
do
=
nav_link
(
controller:
[
:commit
,
:commits
])
do
=
link_to
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@repository
.
root_ref
)
do
=
link_to
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@re
f
||
@re
pository
.
root_ref
)
do
Commits
Commits
%span
.badge
=
number_with_precision
(
@repository
.
commit_count
,
precision:
0
,
delimiter:
','
)
%span
.badge
=
number_with_precision
(
@repository
.
commit_count
,
precision:
0
,
delimiter:
','
)
=
nav_link
(
controller: :compare
)
do
=
nav_link
(
controller: :compare
)
do
...
...
app/views/projects/commits/show.html.haml
View file @
9694c816
...
@@ -8,11 +8,17 @@
...
@@ -8,11 +8,17 @@
.tree-ref-holder
.tree-ref-holder
=
render
'shared/ref_switcher'
,
destination:
'commits'
=
render
'shared/ref_switcher'
,
destination:
'commits'
-
if
current_user
&&
current_user
.
private_token
.commits-feed-holder.hidden-xs.hidden-sm
.commits-feed-holder.hidden-xs.hidden-sm
-
if
create_mr_button?
(
@repository
.
root_ref
,
@ref
)
=
link_to
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@ref
,
{
format: :atom
,
private_token:
current_user
.
private_token
}),
title:
"Feed"
,
class:
'btn'
do
=
link_to
create_mr_path
(
@repository
.
root_ref
,
@ref
),
class:
'btn btn-success'
do
%i
.fa.fa-rss
=
icon
(
'plus'
)
Commits feed
Create Merge Request
-
if
current_user
&&
current_user
.
private_token
=
link_to
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@ref
,
{
format: :atom
,
private_token:
current_user
.
private_token
}),
title:
"Feed"
,
class:
'prepend-left-10 btn'
do
=
icon
(
"rss"
)
Commits Feed
%ul
.breadcrumb.repo-breadcrumb
%ul
.breadcrumb.repo-breadcrumb
=
commits_breadcrumbs
=
commits_breadcrumbs
...
...
app/views/projects/compare/_form.html.haml
View file @
9694c816
...
@@ -13,9 +13,10 @@
...
@@ -13,9 +13,10 @@
=
text_field_tag
:to
,
params
[
:to
],
class:
"form-control"
=
text_field_tag
:to
,
params
[
:to
],
class:
"form-control"
=
button_tag
"Compare"
,
class:
"btn btn-create commits-compare-btn"
=
button_tag
"Compare"
,
class:
"btn btn-create commits-compare-btn"
-
if
compare_to_mr_button?
-
if
create_mr_button?
=
link_to
compare_mr_path
,
class:
'prepend-left-10 btn'
do
=
link_to
create_mr_path
,
class:
'prepend-left-10 btn'
do
%strong
Make a merge request
=
icon
(
"plus"
)
Create Merge Request
:javascript
:javascript
...
...
doc/development/migration_style_guide.md
View file @
9694c816
# Migration Style Guide
# Migration Style Guide
When writing migrations for GitLab, you have to take into account that
When writing migrations for GitLab, you have to take into account that
these will be ran by thousands of organizations of all sizes, some with
these will be ran by
hundreds of
thousands of organizations of all sizes, some with
many years of data in their database.
many years of data in their database.
In addition, having to take a server offline for a an upgrade small or big is
In addition, having to take a server offline for a an upgrade small or big is
a big burden for most organizations. For this reason it is important that your
a big burden for most organizations. For this reason it is important that your
migrations are written carefully and adhere to the style guide below.
migrations are written carefully
, can be applied online
and adhere to the style guide below.
When writing your migrations, also consider that databases might have stale data
When writing your migrations, also consider that databases might have stale data
or inconsistencies and guard for that. Try to make as little assumptions as possible
or inconsistencies and guard for that. Try to make as little assumptions as possible
about the state of the database.
about the state of the database.
Please don't depend on GitLab specific code since it can change in future versions.
If needed copy-paste GitLab code into the migration to make make it forward compatible.
## Comments in the migration
## Comments in the migration
Each migration you write needs to have the two following pieces of information
Each migration you write needs to have the two following pieces of information
...
...
features/steps/project/commits/commits.rb
View file @
9694c816
...
@@ -12,7 +12,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
...
@@ -12,7 +12,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end
end
step
'I click atom feed link'
do
step
'I click atom feed link'
do
click_link
"Feed"
click_link
"
Commits
Feed"
end
end
step
'I see commits atom feed'
do
step
'I see commits atom feed'
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