Skip to content

Commit c970a22

Browse files
author
Gauvain Pocentek
committed
Remove deprecated methods
Also deprecate {un,}archive_() in favor of {un,}archive(). Fix #115
1 parent 258aab4 commit c970a22

File tree

1 file changed

+13
-66
lines changed

1 file changed

+13
-66
lines changed

gitlab/objects.py

+13-66
Original file line numberDiff line numberDiff line change
@@ -1852,11 +1852,6 @@ class ProjectSnippet(GitlabObject):
18521852
[('project_id', 'project_id'), ('snippet_id', 'id')]),
18531853
)
18541854

1855-
def Content(self, **kwargs):
1856-
warnings.warn("`Content` is deprecated, use `content` instead",
1857-
DeprecationWarning)
1858-
return self.content()
1859-
18601855
def content(self, streamed=False, action=None, chunk_size=1024, **kwargs):
18611856
"""Return the raw content of a snippet.
18621857
@@ -2082,11 +2077,6 @@ class Project(GitlabObject):
20822077
VISIBILITY_INTERNAL = gitlab.VISIBILITY_INTERNAL
20832078
VISIBILITY_PUBLIC = gitlab.VISIBILITY_PUBLIC
20842079

2085-
def tree(self, path='', ref_name='', **kwargs):
2086-
warnings.warn("`tree` is deprecated, use `repository_tree` instead",
2087-
DeprecationWarning)
2088-
return self.repository_tree(path, ref_name, **kwargs)
2089-
20902080
def repository_tree(self, path='', ref_name='', **kwargs):
20912081
"""Return a list of files in the repository.
20922082
@@ -2113,11 +2103,6 @@ def repository_tree(self, path='', ref_name='', **kwargs):
21132103
raise_error_from_response(r, GitlabGetError)
21142104
return r.json()
21152105

2116-
def blob(self, sha, filepath, **kwargs):
2117-
warnings.warn("`blob` is deprecated, use `repository_blob` instead",
2118-
DeprecationWarning)
2119-
return self.repository_blob(sha, filepath, **kwargs)
2120-
21212106
def repository_blob(self, sha, filepath, streamed=False, action=None,
21222107
chunk_size=1024, **kwargs):
21232108
"""Return the content of a file for a commit.
@@ -2205,12 +2190,6 @@ def repository_contributors(self):
22052190
raise_error_from_response(r, GitlabListError)
22062191
return r.json()
22072192

2208-
def archive(self, sha=None, **kwargs):
2209-
warnings.warn("`archive` is deprecated, "
2210-
"use `repository_archive` instead",
2211-
DeprecationWarning)
2212-
return self.repository_archive(sha, **kwargs)
2213-
22142193
def repository_archive(self, sha=None, streamed=False, action=None,
22152194
chunk_size=1024, **kwargs):
22162195
"""Return a tarball of the repository.
@@ -2238,49 +2217,6 @@ def repository_archive(self, sha=None, streamed=False, action=None,
22382217
raise_error_from_response(r, GitlabGetError)
22392218
return utils.response_content(r, streamed, action, chunk_size)
22402219

2241-
def create_file(self, path, branch, content, message, **kwargs):
2242-
"""Creates file in project repository
2243-
2244-
Args:
2245-
path (str): Full path to new file.
2246-
branch (str): The name of branch.
2247-
content (str): Content of the file.
2248-
message (str): Commit message.
2249-
**kwargs: Arbitrary keyword arguments.
2250-
2251-
Raises:
2252-
GitlabConnectionError: If the server cannot be reached.
2253-
GitlabCreateError: If the server fails to perform the request.
2254-
"""
2255-
warnings.warn("`create_file` is deprecated, "
2256-
"use `files.create()` instead",
2257-
DeprecationWarning)
2258-
url = "/projects/%s/repository/files" % self.id
2259-
url += ("?file_path=%s&branch_name=%s&content=%s&commit_message=%s" %
2260-
(path, branch, content, message))
2261-
r = self.gitlab._raw_post(url, data=None, content_type=None, **kwargs)
2262-
raise_error_from_response(r, GitlabCreateError, 201)
2263-
2264-
def update_file(self, path, branch, content, message, **kwargs):
2265-
warnings.warn("`update_file` is deprecated, "
2266-
"use `files.update()` instead",
2267-
DeprecationWarning)
2268-
url = "/projects/%s/repository/files" % self.id
2269-
url += ("?file_path=%s&branch_name=%s&content=%s&commit_message=%s" %
2270-
(path, branch, content, message))
2271-
r = self.gitlab._raw_put(url, data=None, content_type=None, **kwargs)
2272-
raise_error_from_response(r, GitlabUpdateError)
2273-
2274-
def delete_file(self, path, branch, message, **kwargs):
2275-
warnings.warn("`delete_file` is deprecated, "
2276-
"use `files.delete()` instead",
2277-
DeprecationWarning)
2278-
url = "/projects/%s/repository/files" % self.id
2279-
url += ("?file_path=%s&branch_name=%s&commit_message=%s" %
2280-
(path, branch, message))
2281-
r = self.gitlab._raw_delete(url, **kwargs)
2282-
raise_error_from_response(r, GitlabDeleteError)
2283-
22842220
def create_fork_relation(self, forked_from_id):
22852221
"""Create a forked from/to relation between existing projects.
22862222
@@ -2336,7 +2272,7 @@ def unstar(self, **kwargs):
23362272
raise_error_from_response(r, GitlabDeleteError, [200, 304])
23372273
return Project(self.gitlab, r.json()) if r.status_code == 200 else self
23382274

2339-
def archive_(self, **kwargs):
2275+
def archive(self, **kwargs):
23402276
"""Archive a project.
23412277
23422278
Returns:
@@ -2351,7 +2287,12 @@ def archive_(self, **kwargs):
23512287
raise_error_from_response(r, GitlabCreateError, 201)
23522288
return Project(self.gitlab, r.json()) if r.status_code == 201 else self
23532289

2354-
def unarchive_(self, **kwargs):
2290+
def archive_(self, **kwargs):
2291+
warnings.warn("`archive_()` is deprecated, use `archive()` instead",
2292+
DeprecationWarning)
2293+
return self.archive(**kwargs)
2294+
2295+
def unarchive(self, **kwargs):
23552296
"""Unarchive a project.
23562297
23572298
Returns:
@@ -2366,6 +2307,12 @@ def unarchive_(self, **kwargs):
23662307
raise_error_from_response(r, GitlabCreateError, 201)
23672308
return Project(self.gitlab, r.json()) if r.status_code == 201 else self
23682309

2310+
def unarchive_(self, **kwargs):
2311+
warnings.warn("`unarchive_()` is deprecated, "
2312+
"use `unarchive()` instead",
2313+
DeprecationWarning)
2314+
return self.unarchive(**kwargs)
2315+
23692316
def share(self, group_id, group_access, **kwargs):
23702317
"""Share the project with a group.
23712318

0 commit comments

Comments
 (0)