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
Tatuya Kamada
gitlab-ce
Commits
169f16fb
Commit
169f16fb
authored
Sep 20, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Commits#compare, add CompareController
parent
5a5d214d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
21 deletions
+53
-21
app/controllers/commits_controller.rb
app/controllers/commits_controller.rb
+0
-12
app/controllers/compare_controller.rb
app/controllers/compare_controller.rb
+22
-0
app/views/compare/_head.html.haml
app/views/compare/_head.html.haml
+23
-0
app/views/compare/show.html.haml
app/views/compare/show.html.haml
+0
-0
config/routes.rb
config/routes.rb
+1
-4
spec/routing/project_routing_spec.rb
spec/routing/project_routing_spec.rb
+7
-5
No files found.
app/controllers/commits_controller.rb
View file @
169f16fb
...
...
@@ -45,18 +45,6 @@ class CommitsController < ApplicationController
# end
# end
def
compare
result
=
Commit
.
compare
(
project
,
params
[
:from
],
params
[
:to
])
@commits
=
result
[
:commits
]
@commit
=
result
[
:commit
]
@diffs
=
result
[
:diffs
]
@refs_are_same
=
result
[
:same
]
@line_notes
=
[]
@commits
=
CommitDecorator
.
decorate
(
@commits
)
end
def
patch
@commit
=
project
.
commit
(
params
[
:id
])
...
...
app/controllers/compare_controller.rb
0 → 100644
View file @
169f16fb
class
CompareController
<
ApplicationController
before_filter
:project
layout
"project"
# Authorize
before_filter
:add_project_abilities
before_filter
:authorize_read_project!
before_filter
:authorize_code_access!
before_filter
:require_non_empty_project
def
show
result
=
Commit
.
compare
(
project
,
params
[
:from
],
params
[
:to
])
@commits
=
result
[
:commits
]
@commit
=
result
[
:commit
]
@diffs
=
result
[
:diffs
]
@refs_are_same
=
result
[
:same
]
@line_notes
=
[]
@commits
=
CommitDecorator
.
decorate
(
@commits
)
end
end
app/views/compare/_head.html.haml
0 → 100644
View file @
169f16fb
%ul
.nav.nav-tabs
%li
=
render
partial:
'shared/ref_switcher'
,
locals:
{
destination:
'commits'
}
%li
{
class:
"#{'active' if current_page?(project_commits_path(@project)) }"
}
=
link_to
project_commits_path
(
@project
)
do
Commits
%li
{
class:
"#{'active' if current_page?(compare_project_commits_path(@project)) }"
}
=
link_to
compare_project_commits_path
(
@project
)
do
Compare
%li
{
class:
"#{branches_tab_class}"
}
=
link_to
project_repository_path
(
@project
)
do
Branches
%span
.badge
=
@project
.
repo
.
branch_count
%li
{
class:
"#{'active' if current_page?(tags_project_repository_path(@project)) }"
}
=
link_to
tags_project_repository_path
(
@project
)
do
Tags
%span
.badge
=
@project
.
repo
.
tag_count
-
if
current_page?
(
project_commits_path
(
@project
))
&&
current_user
.
private_token
%li
.right
%span
.rss-icon
=
link_to
project_commits_path
(
@project
,
:atom
,
{
private_token:
current_user
.
private_token
,
ref:
@ref
}),
title:
"Feed"
do
=
image_tag
"rss_ui.png"
,
title:
"feed"
app/views/com
mits/compare
.html.haml
→
app/views/com
pare/show
.html.haml
View file @
169f16fb
File moved
config/routes.rb
View file @
169f16fb
...
...
@@ -162,10 +162,6 @@ Gitlab::Application.routes.draw do
resources
:commit
,
only:
[
:show
],
constraints:
{
id:
/[[:alnum:]]{6,40}/
}
resources
:commits
,
only:
[
:index
,
:show
]
do
collection
do
get
:compare
end
member
do
get
:patch
end
...
...
@@ -194,6 +190,7 @@ Gitlab::Application.routes.draw do
resources
:blob
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
# resources :raw, only: [:show], constraints: {id: /.+/}
resources
:tree
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
match
"/compare/:from...:to"
=>
"compare#show"
,
as:
"compare"
,
constraints:
{
from:
/.+/
,
to:
/.+/
}
end
root
to:
"dashboard#index"
...
...
spec/routing/project_routing_spec.rb
View file @
169f16fb
...
...
@@ -289,16 +289,11 @@ describe CommitController, "routing" do
end
end
# compare_project_commits GET /:project_id/commits/compare(.:format) commits#compare
# patch_project_commit GET /:project_id/commits/:id/patch(.:format) commits#patch
# project_commits GET /:project_id/commits(.:format) commits#index
# POST /:project_id/commits(.:format) commits#create
# project_commit GET /:project_id/commits/:id(.:format) commits#show
describe
CommitsController
,
"routing"
do
it
"to #compare"
do
get
(
"/gitlabhq/commits/compare"
).
should
route_to
(
'commits#compare'
,
project_id:
'gitlabhq'
)
end
it
"to #patch"
do
get
(
"/gitlabhq/commits/1/patch"
).
should
route_to
(
'commits#patch'
,
project_id:
'gitlabhq'
,
id:
'1'
)
end
...
...
@@ -407,6 +402,13 @@ describe TreeController, "routing" do
end
end
describe
CompareController
,
"routing"
do
it
"to #show"
do
get
(
"/gitlabhq/compare/master...stable"
).
should
route_to
(
'compare#show'
,
project_id:
'gitlabhq'
,
from:
'master'
,
to:
'stable'
)
get
(
"/gitlabhq/compare/issue/1234...stable"
).
should
route_to
(
'compare#show'
,
project_id:
'gitlabhq'
,
from:
'issue/1234'
,
to:
'stable'
)
end
end
# TODO: Pending
#
# /:project_id/blame/*path
...
...
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