Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit867b7ab

Browse files
author
Gauvain Pocentek
committed
MR: add (un)subscribe support
1 parentd340d31 commit867b7ab

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

‎gitlab/objects.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ def unsubscribe(self, **kwargs):
10991099
11001100
Raises:
11011101
GitlabConnectionError: If the server cannot be reached.
1102-
GitlabSubscribeError: If the unsubscription cannot be done
1102+
GitlabUnsubscribeError: If the unsubscription cannot be done
11031103
"""
11041104
url= ('/projects/%(project_id)s/issues/%(issue_id)s/subscription'%
11051105
{'project_id':self.project_id,'issue_id':self.id})
@@ -1249,6 +1249,36 @@ def _data_for_gitlab(self, extra_parameters={}, update=False):
12491249
data=json.dumps(d)
12501250
returndata
12511251

1252+
defsubscribe(self,**kwargs):
1253+
"""Subscribe to a MR.
1254+
1255+
Raises:
1256+
GitlabConnectionError: If the server cannot be reached.
1257+
GitlabSubscribeError: If the subscription cannot be done
1258+
"""
1259+
url= ('/projects/%(project_id)s/merge_requests/%(mr_id)s/'
1260+
'subscription'%
1261+
{'project_id':self.project_id,'mr_id':self.id})
1262+
1263+
r=self.gitlab._raw_post(url,**kwargs)
1264+
raise_error_from_response(r,GitlabSubscribeError, [201,304])
1265+
self._set_from_dict(r.json())
1266+
1267+
defunsubscribe(self,**kwargs):
1268+
"""Unsubscribe a MR.
1269+
1270+
Raises:
1271+
GitlabConnectionError: If the server cannot be reached.
1272+
GitlabUnsubscribeError: If the unsubscription cannot be done
1273+
"""
1274+
url= ('/projects/%(project_id)s/merge_requests/%(mr_id)s/'
1275+
'subscription'%
1276+
{'project_id':self.project_id,'mr_id':self.id})
1277+
1278+
r=self.gitlab._raw_delete(url,**kwargs)
1279+
raise_error_from_response(r,GitlabUnsubscribeError, [200,304])
1280+
self._set_from_dict(r.json())
1281+
12521282
defcancel_merge_when_build_succeeds(self,**kwargs):
12531283
"""Cancel merge when build succeeds."""
12541284

@@ -1377,7 +1407,7 @@ def unsubscribe(self, **kwargs):
13771407
13781408
Raises:
13791409
GitlabConnectionError: If the server cannot be reached.
1380-
GitlabSubscribeError: If the unsubscription cannot be done
1410+
GitlabUnsubscribeError: If the unsubscription cannot be done
13811411
"""
13821412
url= ('/projects/%(project_id)s/labels/%(label_id)s/subscription'%
13831413
{'project_id':self.project_id,'label_id':self.name})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp