Make branch deletion RESTful
parent
8bebeb619a
commit
d4ce9c3ee3
|
@ -543,7 +543,9 @@ class GitRepoBranches(Resource):
|
||||||
"branches": branches
|
"branches": branches
|
||||||
}
|
}
|
||||||
|
|
||||||
def delete(self, repo):
|
@git_ns.route('/repositories/<repo>/branches/<branch>')
|
||||||
|
class GitRepoBranchesDeleter(Resource):
|
||||||
|
def delete(self, repo, branch):
|
||||||
"""Delete a given branch in a given repository
|
"""Delete a given branch in a given repository
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -555,19 +557,6 @@ class GitRepoBranches(Resource):
|
||||||
- 404: A JSON object with an "error" key containing the message "Repository not found" or "Branch not found"
|
- 404: A JSON object with an "error" key containing the message "Repository not found" or "Branch not found"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
data = request.json
|
|
||||||
|
|
||||||
if data is None:
|
|
||||||
log.error("Can't delete branch, JSON post data missing")
|
|
||||||
return {"error" : "Parameters missing"}, 400
|
|
||||||
|
|
||||||
if not "branch" in data:
|
|
||||||
log.error("Can't delete branch, 'branch' key in JSON data is missing")
|
|
||||||
return {"error" : "Parameters missing"}, 400
|
|
||||||
|
|
||||||
branch = data['branch']
|
|
||||||
|
|
||||||
|
|
||||||
repo_path = os.path.join(REPOSITORIES_BASE_PATH, repo + ".git")
|
repo_path = os.path.join(REPOSITORIES_BASE_PATH, repo + ".git")
|
||||||
if not os.path.isdir(repo_path):
|
if not os.path.isdir(repo_path):
|
||||||
log.error("Can't get branches of repository repository %s, not found. Looked in %s", repo, repo_path, extra = {"repository" : repo, "path" : repo_path })
|
log.error("Can't get branches of repository repository %s, not found. Looked in %s", repo, repo_path, extra = {"repository" : repo, "path" : repo_path })
|
||||||
|
@ -586,9 +575,6 @@ class GitRepoBranches(Resource):
|
||||||
return {"status": "deleted"}, 200
|
return {"status": "deleted"}, 200
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@git_ns.route('/health')
|
@git_ns.route('/health')
|
||||||
class GitHealth(Resource):
|
class GitHealth(Resource):
|
||||||
def get(self):
|
def get(self):
|
||||||
|
|
Loading…
Reference in New Issue