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
d20f78f7
Commit
d20f78f7
authored
Jul 17, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/create_branch'
parents
d65eb22e
cbe9f56a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
4 deletions
+47
-4
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+4
-2
app/models/repository.rb
app/models/repository.rb
+10
-0
app/views/projects/branches/new.html.haml
app/views/projects/branches/new.html.haml
+24
-0
app/views/projects/repositories/_filter.html.haml
app/views/projects/repositories/_filter.html.haml
+7
-0
config/routes.rb
config/routes.rb
+2
-2
No files found.
app/controllers/projects/branches_controller.rb
View file @
d20f78f7
...
@@ -10,7 +10,9 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -10,7 +10,9 @@ class Projects::BranchesController < Projects::ApplicationController
end
end
def
create
def
create
# TODO: implement
@project
.
repository
.
add_branch
(
params
[
:branch_name
],
params
[
:ref
])
redirect_to
project_branches_path
(
@project
)
end
end
def
destroy
def
destroy
...
@@ -21,7 +23,7 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -21,7 +23,7 @@ class Projects::BranchesController < Projects::ApplicationController
end
end
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
project_branches_path
}
format
.
html
{
redirect_to
project_branches_path
(
@project
)
}
format
.
js
{
render
nothing:
true
}
format
.
js
{
render
nothing:
true
}
end
end
end
end
...
...
app/models/repository.rb
View file @
d20f78f7
...
@@ -35,11 +35,21 @@ class Repository
...
@@ -35,11 +35,21 @@ class Repository
commits
commits
end
end
def
add_branch
(
branch_name
,
ref
)
Rails
.
cache
.
delete
(
cache_key
(
:branch_names
))
gitlab_shell
.
add_branch
(
path_with_namespace
,
branch_name
,
ref
)
end
def
rm_branch
(
branch_name
)
def
rm_branch
(
branch_name
)
Rails
.
cache
.
delete
(
cache_key
(
:branch_names
))
gitlab_shell
.
rm_branch
(
path_with_namespace
,
branch_name
)
gitlab_shell
.
rm_branch
(
path_with_namespace
,
branch_name
)
end
end
def
rm_tag
(
tag_name
)
def
rm_tag
(
tag_name
)
Rails
.
cache
.
delete
(
cache_key
(
:tag_names
))
gitlab_shell
.
rm_tag
(
path_with_namespace
,
tag_name
)
gitlab_shell
.
rm_tag
(
path_with_namespace
,
tag_name
)
end
end
...
...
app/views/projects/branches/new.html.haml
0 → 100644
View file @
d20f78f7
%h3
.page-title
%i
.icon-code-fork
New branch
=
form_tag
project_branches_path
,
method: :post
do
.control-group
=
label_tag
:branch_name
,
'Name for new branch'
,
class:
'control-label'
.controls
=
text_field_tag
:branch_name
,
nil
,
placeholder:
'feature/dashboard'
.control-group
=
label_tag
:ref
,
'Create from'
,
class:
'control-label'
.controls
=
text_field_tag
:ref
,
nil
,
placeholder:
'master'
.light
branch name or commit SHA
.form-actions
=
submit_tag
'Create branch'
,
class:
'btn btn-create'
=
link_to
'Cancel'
,
project_branches_path
(
@project
),
class:
'btn btn-cancel'
:javascript
var
availableTags
=
#{
@project
.
repository
.
ref_names
.
to_json
}
;
$
(
"
#ref
"
).
autocomplete
({
source
:
availableTags
,
minLength
:
1
});
app/views/projects/repositories/_filter.html.haml
View file @
d20f78f7
...
@@ -7,3 +7,10 @@
...
@@ -7,3 +7,10 @@
%i
.icon-lock
%i
.icon-lock
=
nav_link
(
path:
'branches#index'
)
do
=
nav_link
(
path:
'branches#index'
)
do
=
link_to
'All branches'
,
project_branches_path
(
@project
)
=
link_to
'All branches'
,
project_branches_path
(
@project
)
%hr
=
link_to
new_project_branch_path
(
@project
),
class:
'btn btn-create'
do
%i
.icon-add-sign
New branch
config/routes.rb
View file @
d20f78f7
...
@@ -223,8 +223,8 @@ Gitlab::Application.routes.draw do
...
@@ -223,8 +223,8 @@ Gitlab::Application.routes.draw do
end
end
end
end
resources
:tags
,
only:
[
:index
,
:create
,
:destroy
]
resources
:tags
,
only:
[
:index
,
:
new
,
:
create
,
:destroy
]
resources
:branches
,
only:
[
:index
,
:create
,
:destroy
]
resources
:branches
,
only:
[
:index
,
:
new
,
:
create
,
:destroy
]
resources
:protected_branches
,
only:
[
:index
,
:create
,
:destroy
]
resources
:protected_branches
,
only:
[
:index
,
:create
,
:destroy
]
resources
:refs
,
only:
[]
do
resources
:refs
,
only:
[]
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