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
1e6766f9
Commit
1e6766f9
authored
May 21, 2014
by
Sean Edge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CreateTagService. Use new service to allow tag creation through API.
parent
3e1853c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
app/services/create_tag_service.rb
app/services/create_tag_service.rb
+13
-0
lib/api/repositories.rb
lib/api/repositories.rb
+16
-0
No files found.
app/services/create_tag_service.rb
0 → 100644
View file @
1e6766f9
class
CreateTagService
def
execute
(
project
,
tag_name
,
ref
,
current_user
)
repository
=
project
.
repository
repository
.
add_tag
(
tag_name
,
ref
)
new_tag
=
repository
.
find_tag
(
tag_name
)
if
new_tag
Event
.
create_ref_event
(
project
,
current_user
,
new_tag
,
'add'
,
'refs/tags'
)
end
new_tag
end
end
lib/api/repositories.rb
View file @
1e6766f9
...
...
@@ -25,6 +25,22 @@ module API
present
user_project
.
repo
.
tags
.
sort_by
(
&
:name
).
reverse
,
with:
Entities
::
RepoObject
,
project:
user_project
end
# Create tag
#
# Parameters:
# id (required) - The ID of a project
# tag_name (required) - The name of the tag
# ref (required) - Create tag from commit sha or branch
# Example Request:
# POST /projects/:id/repository/tags
post
':id/repository/tags'
do
authorize_push_project
@tag
=
CreateTagService
.
new
.
execute
(
user_project
,
params
[
:tag_name
],
params
[
:ref
],
current_user
)
present
@tag
,
with:
Entities
::
RepoObject
,
project:
user_project
end
# Get a project repository tree
#
# Parameters:
...
...
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