diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2016-11-05 15:17:41 +0100 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2016-11-05 15:18:40 +0100 |
commit | c970a22e933523b02f3536113ed5afc7a7e9ffe5 (patch) | |
tree | 12e271da9366579dfa8ec7bd3be2eedccd740430 /gitlab/objects.py | |
parent | 258aab45e5f9a2097de61f0927e9fa561b058185 (diff) | |
download | gitlab-c970a22e933523b02f3536113ed5afc7a7e9ffe5.tar.gz |
Remove deprecated methods
Also deprecate {un,}archive_() in favor of {un,}archive().
Fix #115
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r-- | gitlab/objects.py | 79 |
1 files changed, 13 insertions, 66 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py index 93fcb49..f9b29a0 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -1852,11 +1852,6 @@ class ProjectSnippet(GitlabObject): [('project_id', 'project_id'), ('snippet_id', 'id')]), ) - def Content(self, **kwargs): - warnings.warn("`Content` is deprecated, use `content` instead", - DeprecationWarning) - return self.content() - def content(self, streamed=False, action=None, chunk_size=1024, **kwargs): """Return the raw content of a snippet. @@ -2082,11 +2077,6 @@ class Project(GitlabObject): VISIBILITY_INTERNAL = gitlab.VISIBILITY_INTERNAL VISIBILITY_PUBLIC = gitlab.VISIBILITY_PUBLIC - def tree(self, path='', ref_name='', **kwargs): - warnings.warn("`tree` is deprecated, use `repository_tree` instead", - DeprecationWarning) - return self.repository_tree(path, ref_name, **kwargs) - def repository_tree(self, path='', ref_name='', **kwargs): """Return a list of files in the repository. @@ -2113,11 +2103,6 @@ class Project(GitlabObject): raise_error_from_response(r, GitlabGetError) return r.json() - def blob(self, sha, filepath, **kwargs): - warnings.warn("`blob` is deprecated, use `repository_blob` instead", - DeprecationWarning) - return self.repository_blob(sha, filepath, **kwargs) - def repository_blob(self, sha, filepath, streamed=False, action=None, chunk_size=1024, **kwargs): """Return the content of a file for a commit. @@ -2205,12 +2190,6 @@ class Project(GitlabObject): raise_error_from_response(r, GitlabListError) return r.json() - def archive(self, sha=None, **kwargs): - warnings.warn("`archive` is deprecated, " - "use `repository_archive` instead", - DeprecationWarning) - return self.repository_archive(sha, **kwargs) - def repository_archive(self, sha=None, streamed=False, action=None, chunk_size=1024, **kwargs): """Return a tarball of the repository. @@ -2238,49 +2217,6 @@ class Project(GitlabObject): raise_error_from_response(r, GitlabGetError) return utils.response_content(r, streamed, action, chunk_size) - def create_file(self, path, branch, content, message, **kwargs): - """Creates file in project repository - - Args: - path (str): Full path to new file. - branch (str): The name of branch. - content (str): Content of the file. - message (str): Commit message. - **kwargs: Arbitrary keyword arguments. - - Raises: - GitlabConnectionError: If the server cannot be reached. - GitlabCreateError: If the server fails to perform the request. - """ - warnings.warn("`create_file` is deprecated, " - "use `files.create()` instead", - DeprecationWarning) - url = "/projects/%s/repository/files" % self.id - url += ("?file_path=%s&branch_name=%s&content=%s&commit_message=%s" % - (path, branch, content, message)) - r = self.gitlab._raw_post(url, data=None, content_type=None, **kwargs) - raise_error_from_response(r, GitlabCreateError, 201) - - def update_file(self, path, branch, content, message, **kwargs): - warnings.warn("`update_file` is deprecated, " - "use `files.update()` instead", - DeprecationWarning) - url = "/projects/%s/repository/files" % self.id - url += ("?file_path=%s&branch_name=%s&content=%s&commit_message=%s" % - (path, branch, content, message)) - r = self.gitlab._raw_put(url, data=None, content_type=None, **kwargs) - raise_error_from_response(r, GitlabUpdateError) - - def delete_file(self, path, branch, message, **kwargs): - warnings.warn("`delete_file` is deprecated, " - "use `files.delete()` instead", - DeprecationWarning) - url = "/projects/%s/repository/files" % self.id - url += ("?file_path=%s&branch_name=%s&commit_message=%s" % - (path, branch, message)) - r = self.gitlab._raw_delete(url, **kwargs) - raise_error_from_response(r, GitlabDeleteError) - def create_fork_relation(self, forked_from_id): """Create a forked from/to relation between existing projects. @@ -2336,7 +2272,7 @@ class Project(GitlabObject): raise_error_from_response(r, GitlabDeleteError, [200, 304]) return Project(self.gitlab, r.json()) if r.status_code == 200 else self - def archive_(self, **kwargs): + def archive(self, **kwargs): """Archive a project. Returns: @@ -2351,7 +2287,12 @@ class Project(GitlabObject): raise_error_from_response(r, GitlabCreateError, 201) return Project(self.gitlab, r.json()) if r.status_code == 201 else self - def unarchive_(self, **kwargs): + def archive_(self, **kwargs): + warnings.warn("`archive_()` is deprecated, use `archive()` instead", + DeprecationWarning) + return self.archive(**kwargs) + + def unarchive(self, **kwargs): """Unarchive a project. Returns: @@ -2366,6 +2307,12 @@ class Project(GitlabObject): raise_error_from_response(r, GitlabCreateError, 201) return Project(self.gitlab, r.json()) if r.status_code == 201 else self + def unarchive_(self, **kwargs): + warnings.warn("`unarchive_()` is deprecated, " + "use `unarchive()` instead", + DeprecationWarning) + return self.unarchive(**kwargs) + def share(self, group_id, group_access, **kwargs): """Share the project with a group. |