Added CLI command for repo deletion
authorSybren A. Stüvel <sybren@stuvel.eu>
Fri, 3 Nov 2017 14:55:42 +0000 (15:55 +0100)
committerSybren A. Stüvel <sybren@stuvel.eu>
Fri, 3 Nov 2017 14:55:42 +0000 (15:55 +0100)
svnman/cli.py
svnman/remote.py

index da99f48..1e457ed 100644 (file)
@@ -70,4 +70,17 @@ def revoke(repo_id, username):
     log.info('Done')
 
 
+@manager_svnman.command
+def delete(repo_id):
+    """Deletes a repository. This cannot be undone via the API."""
+
+    from . import current_svnman
+
+    log.info('Deleting repository %r', repo_id)
+    input('Press ENTER to continue irrevocable repository deletion')
+
+    current_svnman.remote.delete_repo(repo_id)
+    log.info('Done')
+
+
 manager.add_command('svn', manager_svnman)
index aeb66dd..8b13430 100644 (file)
@@ -103,3 +103,10 @@ class API:
             'revoke': revoke,
         })
         self._raise_for_status(resp)
+
+    def delete_repo(self, repo_id: str):
+        """Deletes a repository, cannot be undone through the API."""
+
+        self._log.info('Deleting repository %r', repo_id)
+        resp = self._request('DELETE', f'repo/{repo_id}')
+        self._raise_for_status(resp)