# HG changeset patch # User Serhii Ilin # Date 2024-06-05 10:30:06 # Node ID f0acf3f632fd7ffc2d9e3afc22b051b386fa8aad # Parent 3da621d753e9bc1bf838748cec1cb8a0adc2914a feat(branch removal trough UI): Added delete_branch method for git. Fixes: RCCE-75 diff --git a/vcsserver/remote/git_remote.py b/vcsserver/remote/git_remote.py --- a/vcsserver/remote/git_remote.py +++ b/vcsserver/remote/git_remote.py @@ -551,6 +551,13 @@ class GitRemote(RemoteBase): return _branch(context_uid, repo_id, commit_id) @reraise_safe_exceptions + def delete_branch(self, wire, branch_name): + repo_init = self._factory.repo_libgit2(wire) + with repo_init as repo: + if branch := repo.lookup_branch(branch_name): + branch.delete() + + @reraise_safe_exceptions def commit_branches(self, wire, commit_id): cache_on, context_uid, repo_id = self._cache_on(wire) region = self._region(wire)