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
Kazuhiko Shiozaki
gitlab-ce
Commits
6cb626ef
Commit
6cb626ef
authored
Sep 25, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Compare#index and Compare#create actions
Create just redirects to our specially-formatted #show action
parent
8fe63dab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
app/controllers/compare_controller.rb
app/controllers/compare_controller.rb
+7
-0
config/routes.rb
config/routes.rb
+1
-1
spec/routing/project_routing_spec.rb
spec/routing/project_routing_spec.rb
+5
-0
No files found.
app/controllers/compare_controller.rb
View file @
6cb626ef
...
...
@@ -8,6 +8,9 @@ class CompareController < ApplicationController
before_filter
:authorize_code_access!
before_filter
:require_non_empty_project
def
index
end
def
show
result
=
Commit
.
compare
(
project
,
params
[
:from
],
params
[
:to
])
...
...
@@ -19,4 +22,8 @@ class CompareController < ApplicationController
@commits
=
CommitDecorator
.
decorate
(
@commits
)
end
def
create
redirect_to
project_compare_path
(
@project
,
params
[
:from
],
params
[
:to
])
end
end
config/routes.rb
View file @
6cb626ef
...
...
@@ -162,7 +162,7 @@ Gitlab::Application.routes.draw do
# XXX: WIP
resources
:commit
,
only:
[
:show
],
constraints:
{
id:
/[[:alnum:]]{6,40}/
}
resources
:commits
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:compare
,
only:
[
:index
]
resources
:compare
,
only:
[
:index
,
:create
]
resources
:blame
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:blob
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:tree
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
...
...
spec/routing/project_routing_spec.rb
View file @
6cb626ef
...
...
@@ -399,12 +399,17 @@ describe TreeController, "routing" do
end
# project_compare_index GET /:project_id/compare(.:format) compare#index {:id=>/[^\/]+/, :project_id=>/[^\/]+/}
# POST /:project_id/compare(.:format) compare#create {:id=>/[^\/]+/, :project_id=>/[^\/]+/}
# project_compare /:project_id/compare/:from...:to(.:format) compare#show {:from=>/.+/, :to=>/.+/, :id=>/[^\/]+/, :project_id=>/[^\/]+/}
describe
CompareController
,
"routing"
do
it
"to #index"
do
get
(
"/gitlabhq/compare"
).
should
route_to
(
'compare#index'
,
project_id:
'gitlabhq'
)
end
it
"to #compare"
do
post
(
"/gitlabhq/compare"
).
should
route_to
(
'compare#create'
,
project_id:
'gitlabhq'
)
end
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'
)
...
...
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