Module: Gerry::Api::Branches
- Included in:
- Client
- Defined in:
- lib/gerry/api/branches.rb
Instance Method Summary collapse
-
#branch(project_name, branch_name) ⇒ Hash
Get the projects that start with the specified prefix and accessible by the caller.
-
#branch_reflog(project_name, branch, number) ⇒ Object
Gets the reflog of a certain branch.
-
#branches(project_name) ⇒ Object
Get the branches of project.
-
#create_branch(project_name, source, branch) ⇒ Object
create branch that derived from branch name or revision.
Instance Method Details
#branch(project_name, branch_name) ⇒ Hash
Get the projects that start with the specified prefix and accessible by the caller.
18 19 20 |
# File 'lib/gerry/api/branches.rb', line 18 def branch(project_name, branch_name) get("/projects/#{project_name}/branches/#{branch_name}") end |
#branch_reflog(project_name, branch, number) ⇒ Object
Gets the reflog of a certain branch.
40 41 42 |
# File 'lib/gerry/api/branches.rb', line 40 def branch_reflog(project_name, branch, number) get("/projects/#{project_name}/branches/#{branch}/reflog?n=#{number}") end |
#branches(project_name) ⇒ Object
Get the branches of project
9 10 11 |
# File 'lib/gerry/api/branches.rb', line 9 def branches(project_name) get("/projects/#{project_name}/branches") end |
#create_branch(project_name, source, branch) ⇒ Object
create branch that derived from branch name or revision
example: create_branch('foo', 'master', 'stable')
create_branch('foo', 'revision', 'stable')
28 29 30 31 32 33 34 35 36 |
# File 'lib/gerry/api/branches.rb', line 28 def create_branch(project_name, source, branch) # try source as ref body = { ref: source } put("/projects/#{project_name}/branches/#{branch}", body) rescue Gerry::Api::Request::RequestError # try source as revision body = { revision: source } put("/projects/#{project_name}/branches/#{branch}", body) end |