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
5416d0e0
Commit
5416d0e0
authored
Oct 21, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass `@ref` along so we know which pipeline to show
Closes #23615
parent
4028022f
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
44 additions
and
18 deletions
+44
-18
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+2
-1
app/controllers/projects/commits_controller.rb
app/controllers/projects/commits_controller.rb
+8
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+12
-2
app/helpers/ci_status_helper.rb
app/helpers/ci_status_helper.rb
+5
-0
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+5
-3
app/models/commit.rb
app/models/commit.rb
+4
-0
app/views/projects/commits/_commit.html.haml
app/views/projects/commits/_commit.html.haml
+2
-2
app/views/projects/commits/_commit_list.html.haml
app/views/projects/commits/_commit_list.html.haml
+1
-1
app/views/projects/commits/_commits.html.haml
app/views/projects/commits/_commits.html.haml
+1
-4
app/views/projects/commits/show.html.haml
app/views/projects/commits/show.html.haml
+1
-1
app/views/projects/merge_requests/branch_from.html.haml
app/views/projects/merge_requests/branch_from.html.haml
+1
-1
app/views/projects/merge_requests/branch_to.html.haml
app/views/projects/merge_requests/branch_to.html.haml
+1
-1
app/views/projects/merge_requests/show/_commits.html.haml
app/views/projects/merge_requests/show/_commits.html.haml
+1
-1
No files found.
app/controllers/application_controller.rb
View file @
5416d0e0
...
@@ -192,9 +192,10 @@ class ApplicationController < ActionController::Base
...
@@ -192,9 +192,10 @@ class ApplicationController < ActionController::Base
end
end
# JSON for infinite scroll via Pager object
# JSON for infinite scroll via Pager object
def
pager_json
(
partial
,
count
)
def
pager_json
(
partial
,
count
,
locals
=
{}
)
html
=
render_to_string
(
html
=
render_to_string
(
partial
,
partial
,
locals:
locals
,
layout:
false
,
layout:
false
,
formats:
[
:html
]
formats:
[
:html
]
)
)
...
...
app/controllers/projects/commits_controller.rb
View file @
5416d0e0
...
@@ -26,8 +26,15 @@ class Projects::CommitsController < Projects::ApplicationController
...
@@ -26,8 +26,15 @@ class Projects::CommitsController < Projects::ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
json
{
pager_json
(
"projects/commits/_commits"
,
@commits
.
size
)
}
format
.
atom
{
render
layout:
false
}
format
.
atom
{
render
layout:
false
}
format
.
json
do
pager_json
(
'projects/commits/_commits'
,
@commits
.
size
,
project:
@project
,
ref:
@ref
)
end
end
end
end
end
end
end
app/controllers/projects/merge_requests_controller.rb
View file @
5416d0e0
...
@@ -352,13 +352,23 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -352,13 +352,23 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
branch_from
def
branch_from
# This is always source
# This is always source
@source_project
=
@merge_request
.
nil?
?
@project
:
@merge_request
.
source_project
@source_project
=
@merge_request
.
nil?
?
@project
:
@merge_request
.
source_project
@commit
=
@repository
.
commit
(
params
[
:ref
])
if
params
[
:ref
].
present?
if
params
[
:ref
].
present?
@ref
=
params
[
:ref
]
@commit
=
@repository
.
commit
(
@ref
)
end
render
layout:
false
render
layout:
false
end
end
def
branch_to
def
branch_to
@target_project
=
selected_target_project
@target_project
=
selected_target_project
@commit
=
@target_project
.
commit
(
params
[
:ref
])
if
params
[
:ref
].
present?
if
params
[
:ref
].
present?
@ref
=
params
[
:ref
]
@commit
=
@target_project
.
commit
(
@ref
)
end
render
layout:
false
render
layout:
false
end
end
...
...
app/helpers/ci_status_helper.rb
View file @
5416d0e0
...
@@ -54,6 +54,11 @@ module CiStatusHelper
...
@@ -54,6 +54,11 @@ module CiStatusHelper
custom_icon
(
icon_name
)
custom_icon
(
icon_name
)
end
end
def
render_commit_ref_status
(
commit
,
ref
=
nil
,
**
args
)
pipeline
=
commit
.
pipelines_for
(
ref
).
last
render_pipeline_status
(
pipeline
,
**
args
)
end
def
render_commit_status
(
commit
,
tooltip_placement:
'auto left'
)
def
render_commit_status
(
commit
,
tooltip_placement:
'auto left'
)
project
=
commit
.
project
project
=
commit
.
project
path
=
pipelines_namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
)
path
=
pipelines_namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
)
...
...
app/helpers/commits_helper.rb
View file @
5416d0e0
...
@@ -25,9 +25,11 @@ module CommitsHelper
...
@@ -25,9 +25,11 @@ module CommitsHelper
end
end
end
end
def
commit_to_html
(
commit
,
project
,
inline
=
true
)
def
commit_to_html
(
commit
,
ref
,
project
)
template
=
inline
?
"inline_commit"
:
"commit"
render
'projects/commits/commit'
,
render
"projects/commits/
#{
template
}
"
,
commit:
commit
,
project:
project
unless
commit
.
nil?
commit:
commit
,
ref:
ref
,
project:
project
end
end
# Breadcrumb links for a Project and, if applicable, a tree path
# Breadcrumb links for a Project and, if applicable, a tree path
...
...
app/models/commit.rb
View file @
5416d0e0
...
@@ -225,6 +225,10 @@ class Commit
...
@@ -225,6 +225,10 @@ class Commit
)
)
end
end
def
pipelines_for
(
ref
)
project
.
pipelines
.
where
(
sha:
sha
,
ref:
ref
)
end
def
pipelines
def
pipelines
@pipeline
||=
project
.
pipelines
.
where
(
sha:
sha
)
@pipeline
||=
project
.
pipelines
.
where
(
sha:
sha
)
end
end
...
...
app/views/projects/commits/_commit.html.haml
View file @
5416d0e0
...
@@ -20,13 +20,13 @@
...
@@ -20,13 +20,13 @@
=
commit
.
short_id
=
commit
.
short_id
-
if
commit
.
status
-
if
commit
.
status
.visible-xs-inline
.visible-xs-inline
=
render_commit_
status
(
commit
)
=
render_commit_
ref_status
(
commit
,
ref
)
-
if
commit
.
description?
-
if
commit
.
description?
%a
.text-expander.hidden-xs.js-toggle-button
...
%a
.text-expander.hidden-xs.js-toggle-button
...
.commit-actions.hidden-xs
.commit-actions.hidden-xs
-
if
commit
.
status
-
if
commit
.
status
=
render_commit_
status
(
commit
)
=
render_commit_
ref_status
(
commit
,
ref
)
=
clipboard_button
(
clipboard_text:
commit
.
id
)
=
clipboard_button
(
clipboard_text:
commit
.
id
)
=
link_to
commit
.
short_id
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
),
class:
"commit-short-id btn btn-transparent"
=
link_to
commit
.
short_id
,
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
),
class:
"commit-short-id btn btn-transparent"
=
link_to_browse_code
(
project
,
commit
)
=
link_to_browse_code
(
project
,
commit
)
...
...
app/views/projects/commits/_commit_list.html.haml
View file @
5416d0e0
...
@@ -11,4 +11,4 @@
...
@@ -11,4 +11,4 @@
%li
.warning-row.unstyled
%li
.warning-row.unstyled
#{
number_with_delimiter
(
hidden
)
}
additional commits have been omitted to prevent performance issues.
#{
number_with_delimiter
(
hidden
)
}
additional commits have been omitted to prevent performance issues.
-
else
-
else
%ul
.content-list
=
render
commits
,
project:
@project
%ul
.content-list
=
render
commits
,
project:
@project
,
ref:
@ref
app/views/projects/commits/_commits.html.haml
View file @
5416d0e0
-
unless
defined?
(
project
)
-
project
=
@project
-
commits
,
hidden
=
limited_commits
(
@commits
)
-
commits
,
hidden
=
limited_commits
(
@commits
)
-
commits
.
chunk
{
|
c
|
c
.
committed_date
.
in_time_zone
.
to_date
}.
each
do
|
day
,
commits
|
-
commits
.
chunk
{
|
c
|
c
.
committed_date
.
in_time_zone
.
to_date
}.
each
do
|
day
,
commits
|
%li
.commit-header
=
"
#{
day
.
strftime
(
'%d %b, %Y'
)
}
#{
pluralize
(
commits
.
count
,
'commit'
)
}
"
%li
.commit-header
=
"
#{
day
.
strftime
(
'%d %b, %Y'
)
}
#{
pluralize
(
commits
.
count
,
'commit'
)
}
"
%li
.commits-row
%li
.commits-row
%ul
.list-unstyled.commit-list
%ul
.list-unstyled.commit-list
=
render
commits
,
project:
project
=
render
commits
,
project:
project
,
ref:
ref
-
if
hidden
>
0
-
if
hidden
>
0
%li
.alert.alert-warning
%li
.alert.alert-warning
...
...
app/views/projects/commits/show.html.haml
View file @
5416d0e0
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
%div
{
id:
dom_id
(
@project
)}
%div
{
id:
dom_id
(
@project
)}
%ol
#commits-list
.list-unstyled.content_list
%ol
#commits-list
.list-unstyled.content_list
=
render
"commits"
,
project:
@project
=
render
'commits'
,
project:
@project
,
ref:
@ref
=
spinner
=
spinner
:javascript
:javascript
...
...
app/views/projects/merge_requests/branch_from.html.haml
View file @
5416d0e0
=
commit_to_html
(
@commit
,
@
source_project
,
false
)
=
commit_to_html
(
@commit
,
@
ref
,
@source_project
)
if
@commit
app/views/projects/merge_requests/branch_to.html.haml
View file @
5416d0e0
=
commit_to_html
(
@commit
,
@
target_project
,
false
)
=
commit_to_html
(
@commit
,
@
ref
,
@target_project
)
if
@commit
app/views/projects/merge_requests/show/_commits.html.haml
View file @
5416d0e0
...
@@ -3,4 +3,4 @@
...
@@ -3,4 +3,4 @@
Most recent commits displayed first
Most recent commits displayed first
%ol
#commits-list
.list-unstyled
%ol
#commits-list
.list-unstyled
=
render
"projects/commits/commits"
,
project:
@merge_request
.
project
=
render
"projects/commits/commits"
,
project:
@merge_request
.
project
,
ref:
@merge_request
.
source_branch
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