python-gerrit-api 3.0.6__tar.gz → 3.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python-gerrit-api-3.0.6/python_gerrit_api.egg-info → python-gerrit-api-3.0.7}/PKG-INFO +1 -2
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/__init__.py +1 -1
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/accounts/account.py +66 -28
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/accounts/accounts.py +5 -2
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/accounts/emails.py +4 -2
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/accounts/gpg_keys.py +4 -5
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/accounts/ssh_keys.py +7 -7
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/base.py +5 -6
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/changes/change.py +66 -38
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/changes/changes.py +4 -5
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/changes/comments.py +8 -3
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/changes/drafts.py +9 -3
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/changes/edit.py +17 -8
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/changes/files.py +17 -6
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/changes/messages.py +5 -2
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/changes/reviewers.py +15 -6
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/changes/revision.py +26 -12
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/config/caches.py +3 -1
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/config/config.py +19 -6
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/groups/group.py +10 -4
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/groups/groups.py +14 -6
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/groups/members.py +1 -1
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/plugins/plugins.py +9 -4
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/projects/branches.py +13 -5
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/projects/commit.py +4 -1
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/projects/dashboards.py +5 -2
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/projects/labels.py +5 -2
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/projects/project.py +43 -27
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/projects/projects.py +16 -5
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/projects/tags.py +10 -4
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/projects/webhooks.py +5 -2
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/utils/common.py +4 -6
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/utils/gerritbase.py +2 -1
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/utils/requester.py +23 -12
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gitiles/base.py +4 -5
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7/python_gerrit_api.egg-info}/PKG-INFO +1 -2
- python-gerrit-api-3.0.7/python_gerrit_api.egg-info/requires.txt +1 -0
- python-gerrit-api-3.0.7/requirements.txt +1 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/tests/test_changes.py +2 -2
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/tests/test_groups.py +1 -1
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/tests/test_projects.py +2 -2
- python-gerrit-api-3.0.6/python_gerrit_api.egg-info/requires.txt +0 -2
- python-gerrit-api-3.0.6/requirements.txt +0 -2
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/LICENSE +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/MANIFEST.in +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/README.rst +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/accounts/__init__.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/changes/__init__.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/config/__init__.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/config/tasks.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/groups/__init__.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/groups/subgroups.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/plugins/__init__.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/projects/__init__.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/utils/__init__.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gerrit/utils/exceptions.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/gitiles/__init__.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/python_gerrit_api.egg-info/SOURCES.txt +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/python_gerrit_api.egg-info/dependency_links.txt +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/python_gerrit_api.egg-info/top_level.txt +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/setup.cfg +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/setup.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/tests/test_accounts.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/tests/test_gitiles.py +0 -0
- {python-gerrit-api-3.0.6 → python-gerrit-api-3.0.7}/tests/test_revision.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-gerrit-api
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.7
|
|
4
4
|
Summary: Python wrapper for the Gerrit REST API.
|
|
5
5
|
Home-page: https://github.com/shijl0925/python-gerrit-api
|
|
6
6
|
Author: Jialiang Shi
|
|
@@ -22,7 +22,6 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
22
22
|
Classifier: Topic :: Software Development
|
|
23
23
|
License-File: LICENSE
|
|
24
24
|
Requires-Dist: requests
|
|
25
|
-
Requires-Dist: six>=1.10.0
|
|
26
25
|
|
|
27
26
|
Project description
|
|
28
27
|
===================
|
|
@@ -54,8 +54,9 @@ class GerritAccount(GerritBase):
|
|
|
54
54
|
https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-name-input
|
|
55
55
|
:return:
|
|
56
56
|
"""
|
|
57
|
-
return self.gerrit.put(
|
|
58
|
-
|
|
57
|
+
return self.gerrit.put(
|
|
58
|
+
self.endpoint + "/name", json=input_, headers=self.gerrit.default_headers
|
|
59
|
+
)
|
|
59
60
|
|
|
60
61
|
def delete_name(self):
|
|
61
62
|
"""
|
|
@@ -87,8 +88,9 @@ class GerritAccount(GerritBase):
|
|
|
87
88
|
:return:
|
|
88
89
|
"""
|
|
89
90
|
input_ = {"status": status}
|
|
90
|
-
return self.gerrit.put(
|
|
91
|
-
|
|
91
|
+
return self.gerrit.put(
|
|
92
|
+
self.endpoint + "/status", json=input_, headers=self.gerrit.default_headers
|
|
93
|
+
)
|
|
92
94
|
|
|
93
95
|
def set_username(self, input_):
|
|
94
96
|
"""
|
|
@@ -109,8 +111,11 @@ class GerritAccount(GerritBase):
|
|
|
109
111
|
https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#username-input
|
|
110
112
|
:return:
|
|
111
113
|
"""
|
|
112
|
-
return self.gerrit.put(
|
|
113
|
-
|
|
114
|
+
return self.gerrit.put(
|
|
115
|
+
self.endpoint + "/username",
|
|
116
|
+
json=input_,
|
|
117
|
+
headers=self.gerrit.default_headers,
|
|
118
|
+
)
|
|
114
119
|
|
|
115
120
|
def set_displayname(self, input_):
|
|
116
121
|
"""
|
|
@@ -130,8 +135,11 @@ class GerritAccount(GerritBase):
|
|
|
130
135
|
https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#display-name-input
|
|
131
136
|
:return:
|
|
132
137
|
"""
|
|
133
|
-
return self.gerrit.put(
|
|
134
|
-
|
|
138
|
+
return self.gerrit.put(
|
|
139
|
+
self.endpoint + "/displayname",
|
|
140
|
+
json=input_,
|
|
141
|
+
headers=self.gerrit.default_headers,
|
|
142
|
+
)
|
|
135
143
|
|
|
136
144
|
def get_active(self):
|
|
137
145
|
"""
|
|
@@ -176,8 +184,11 @@ class GerritAccount(GerritBase):
|
|
|
176
184
|
https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#http-password-input
|
|
177
185
|
:return:
|
|
178
186
|
"""
|
|
179
|
-
return self.gerrit.put(
|
|
180
|
-
|
|
187
|
+
return self.gerrit.put(
|
|
188
|
+
self.endpoint + "/password.http",
|
|
189
|
+
json=input_,
|
|
190
|
+
headers=self.gerrit.default_headers,
|
|
191
|
+
)
|
|
181
192
|
|
|
182
193
|
def delete_http_password(self):
|
|
183
194
|
"""
|
|
@@ -288,8 +299,11 @@ class GerritAccount(GerritBase):
|
|
|
288
299
|
https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
|
|
289
300
|
:return:
|
|
290
301
|
"""
|
|
291
|
-
return self.gerrit.put(
|
|
292
|
-
|
|
302
|
+
return self.gerrit.put(
|
|
303
|
+
self.endpoint + "/preferences",
|
|
304
|
+
json=input_,
|
|
305
|
+
headers=self.gerrit.default_headers,
|
|
306
|
+
)
|
|
293
307
|
|
|
294
308
|
def get_diff_preferences(self):
|
|
295
309
|
"""
|
|
@@ -327,8 +341,11 @@ class GerritAccount(GerritBase):
|
|
|
327
341
|
https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#diff-preferences-input
|
|
328
342
|
:return:
|
|
329
343
|
"""
|
|
330
|
-
return self.gerrit.put(
|
|
331
|
-
|
|
344
|
+
return self.gerrit.put(
|
|
345
|
+
self.endpoint + "/preferences.diff",
|
|
346
|
+
json=input_,
|
|
347
|
+
headers=self.gerrit.default_headers,
|
|
348
|
+
)
|
|
332
349
|
|
|
333
350
|
def get_edit_preferences(self):
|
|
334
351
|
"""
|
|
@@ -368,8 +385,11 @@ class GerritAccount(GerritBase):
|
|
|
368
385
|
https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#edit-preferences-info
|
|
369
386
|
:return:
|
|
370
387
|
"""
|
|
371
|
-
return self.gerrit.put(
|
|
372
|
-
|
|
388
|
+
return self.gerrit.put(
|
|
389
|
+
self.endpoint + "/preferences.edit",
|
|
390
|
+
json=input_,
|
|
391
|
+
headers=self.gerrit.default_headers,
|
|
392
|
+
)
|
|
373
393
|
|
|
374
394
|
def get_watched_projects(self):
|
|
375
395
|
"""
|
|
@@ -401,8 +421,11 @@ class GerritAccount(GerritBase):
|
|
|
401
421
|
:param input_: the ProjectWatchInfo entities as list
|
|
402
422
|
:return:
|
|
403
423
|
"""
|
|
404
|
-
return self.gerrit.post(
|
|
405
|
-
|
|
424
|
+
return self.gerrit.post(
|
|
425
|
+
self.endpoint + "/watched.projects",
|
|
426
|
+
json=input_,
|
|
427
|
+
headers=self.gerrit.default_headers,
|
|
428
|
+
)
|
|
406
429
|
|
|
407
430
|
def delete_watched_projects(self, input_):
|
|
408
431
|
"""
|
|
@@ -423,8 +446,11 @@ class GerritAccount(GerritBase):
|
|
|
423
446
|
:param input_: the watched projects as list
|
|
424
447
|
:return:
|
|
425
448
|
"""
|
|
426
|
-
self.gerrit.post(
|
|
427
|
-
|
|
449
|
+
self.gerrit.post(
|
|
450
|
+
self.endpoint + "/watched.projects:delete",
|
|
451
|
+
json=input_,
|
|
452
|
+
headers=self.gerrit.default_headers,
|
|
453
|
+
)
|
|
428
454
|
|
|
429
455
|
def get_external_ids(self):
|
|
430
456
|
"""
|
|
@@ -455,8 +481,11 @@ class GerritAccount(GerritBase):
|
|
|
455
481
|
:param input_: the external ids as list
|
|
456
482
|
:return:
|
|
457
483
|
"""
|
|
458
|
-
self.gerrit.post(
|
|
459
|
-
|
|
484
|
+
self.gerrit.post(
|
|
485
|
+
self.endpoint + "/external.ids:delete",
|
|
486
|
+
json=input_,
|
|
487
|
+
headers=self.gerrit.default_headers,
|
|
488
|
+
)
|
|
460
489
|
|
|
461
490
|
def list_contributor_agreements(self):
|
|
462
491
|
"""
|
|
@@ -482,8 +511,11 @@ class GerritAccount(GerritBase):
|
|
|
482
511
|
https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#contributor-agreement-input
|
|
483
512
|
:return:
|
|
484
513
|
"""
|
|
485
|
-
return self.gerrit.put(
|
|
486
|
-
|
|
514
|
+
return self.gerrit.put(
|
|
515
|
+
self.endpoint + "/agreements",
|
|
516
|
+
json=input_,
|
|
517
|
+
headers=self.gerrit.default_headers,
|
|
518
|
+
)
|
|
487
519
|
|
|
488
520
|
def delete_draft_comments(self, input_):
|
|
489
521
|
"""
|
|
@@ -501,8 +533,11 @@ class GerritAccount(GerritBase):
|
|
|
501
533
|
https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#delete-draft-comments-input
|
|
502
534
|
:return:
|
|
503
535
|
"""
|
|
504
|
-
return self.gerrit.post(
|
|
505
|
-
|
|
536
|
+
return self.gerrit.post(
|
|
537
|
+
self.endpoint + "/drafts:delete",
|
|
538
|
+
json=input_,
|
|
539
|
+
headers=self.gerrit.default_headers,
|
|
540
|
+
)
|
|
506
541
|
|
|
507
542
|
def index(self):
|
|
508
543
|
"""
|
|
@@ -578,5 +613,8 @@ class GerritAccount(GerritBase):
|
|
|
578
613
|
https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#stars-input
|
|
579
614
|
:return:
|
|
580
615
|
"""
|
|
581
|
-
return self.gerrit.post(
|
|
582
|
-
|
|
616
|
+
return self.gerrit.post(
|
|
617
|
+
self.endpoint + f"/stars.changes/{id_}",
|
|
618
|
+
json=input_,
|
|
619
|
+
headers=self.gerrit.default_headers,
|
|
620
|
+
)
|
|
@@ -7,7 +7,7 @@ from gerrit.accounts.account import GerritAccount
|
|
|
7
7
|
from gerrit.utils.exceptions import (
|
|
8
8
|
AccountNotFoundError,
|
|
9
9
|
AccountAlreadyExistsError,
|
|
10
|
-
GerritAPIException
|
|
10
|
+
GerritAPIException,
|
|
11
11
|
)
|
|
12
12
|
|
|
13
13
|
|
|
@@ -110,5 +110,8 @@ class GerritAccounts:
|
|
|
110
110
|
raise AccountAlreadyExistsError(message)
|
|
111
111
|
except AccountNotFoundError:
|
|
112
112
|
self.gerrit.put(
|
|
113
|
-
self.endpoint + f"/{username}",
|
|
113
|
+
self.endpoint + f"/{username}",
|
|
114
|
+
json=input_,
|
|
115
|
+
headers=self.gerrit.default_headers,
|
|
116
|
+
)
|
|
114
117
|
return self.get(username)
|
|
@@ -7,7 +7,7 @@ from gerrit.utils.gerritbase import GerritBase
|
|
|
7
7
|
from gerrit.utils.exceptions import (
|
|
8
8
|
AccountEmailNotFoundError,
|
|
9
9
|
AccountEmailAlreadyExistsError,
|
|
10
|
-
GerritAPIException
|
|
10
|
+
GerritAPIException,
|
|
11
11
|
)
|
|
12
12
|
|
|
13
13
|
|
|
@@ -82,7 +82,9 @@ class GerritAccountEmails:
|
|
|
82
82
|
result = self.gerrit.get(self.endpoint + f"/{email}")
|
|
83
83
|
|
|
84
84
|
email_ = result.get("email")
|
|
85
|
-
return GerritAccountEmail(
|
|
85
|
+
return GerritAccountEmail(
|
|
86
|
+
email=email_, account=self.account, gerrit=self.gerrit
|
|
87
|
+
)
|
|
86
88
|
except requests.exceptions.HTTPError as error:
|
|
87
89
|
if error.response.status_code == 404:
|
|
88
90
|
message = f"Account Email {email} does not exist"
|
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
import logging
|
|
5
5
|
import requests
|
|
6
6
|
from gerrit.utils.gerritbase import GerritBase
|
|
7
|
-
from gerrit.utils.exceptions import
|
|
8
|
-
GPGKeyNotFoundError,
|
|
9
|
-
GerritAPIException
|
|
10
|
-
)
|
|
7
|
+
from gerrit.utils.exceptions import GPGKeyNotFoundError, GerritAPIException
|
|
11
8
|
|
|
12
9
|
logger = logging.getLogger(__name__)
|
|
13
10
|
|
|
@@ -120,7 +117,9 @@ class GerritAccountGPGKeys:
|
|
|
120
117
|
https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#gpg-keys-input
|
|
121
118
|
:return:
|
|
122
119
|
"""
|
|
123
|
-
return self.gerrit.post(
|
|
120
|
+
return self.gerrit.post(
|
|
121
|
+
self.endpoint, json=input_, headers=self.gerrit.default_headers
|
|
122
|
+
)
|
|
124
123
|
|
|
125
124
|
def delete(self, id_):
|
|
126
125
|
"""
|
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
import logging
|
|
5
5
|
import requests
|
|
6
6
|
from gerrit.utils.gerritbase import GerritBase
|
|
7
|
-
from gerrit.utils.exceptions import
|
|
8
|
-
SSHKeyNotFoundError,
|
|
9
|
-
GerritAPIException
|
|
10
|
-
)
|
|
7
|
+
from gerrit.utils.exceptions import SSHKeyNotFoundError, GerritAPIException
|
|
11
8
|
|
|
12
9
|
logger = logging.getLogger(__name__)
|
|
13
10
|
|
|
@@ -58,7 +55,9 @@ class GerritAccountSSHKeys:
|
|
|
58
55
|
result = self.gerrit.get(self.endpoint + f"/{str(seq)}")
|
|
59
56
|
|
|
60
57
|
seq = result.get("seq")
|
|
61
|
-
return GerritAccountSSHKey(
|
|
58
|
+
return GerritAccountSSHKey(
|
|
59
|
+
seq=seq, account=self.account, gerrit=self.gerrit
|
|
60
|
+
)
|
|
62
61
|
except requests.exceptions.HTTPError as error:
|
|
63
62
|
if error.response.status_code == 404:
|
|
64
63
|
message = f"SSH key {seq} does not exist"
|
|
@@ -73,8 +72,9 @@ class GerritAccountSSHKeys:
|
|
|
73
72
|
:param ssh_key: SSH key raw content
|
|
74
73
|
:return:
|
|
75
74
|
"""
|
|
76
|
-
result = self.gerrit.post(
|
|
77
|
-
|
|
75
|
+
result = self.gerrit.post(
|
|
76
|
+
self.endpoint, data=ssh_key, headers={"Content-Type": "plain/text"}
|
|
77
|
+
)
|
|
78
78
|
return result
|
|
79
79
|
|
|
80
80
|
def delete(self, seq):
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
# @Author: Jialiang Shi
|
|
4
4
|
import netrc
|
|
5
5
|
from gerrit.utils.requester import Requester
|
|
6
|
-
from gerrit.utils.common import
|
|
7
|
-
decode_response,
|
|
8
|
-
strip_trailing_slash
|
|
9
|
-
)
|
|
6
|
+
from gerrit.utils.common import decode_response, strip_trailing_slash
|
|
10
7
|
from gerrit.config.config import GerritConfig
|
|
11
8
|
from gerrit.projects.projects import GerritProjects
|
|
12
9
|
from gerrit.accounts.accounts import GerritAccounts
|
|
@@ -33,7 +30,7 @@ class GerritClient:
|
|
|
33
30
|
cert=None,
|
|
34
31
|
timeout=60,
|
|
35
32
|
max_retries=None,
|
|
36
|
-
auth_suffix="/a"
|
|
33
|
+
auth_suffix="/a",
|
|
37
34
|
):
|
|
38
35
|
self._base_url = strip_trailing_slash(base_url)
|
|
39
36
|
|
|
@@ -63,7 +60,9 @@ class GerritClient:
|
|
|
63
60
|
netrc_client = netrc.netrc()
|
|
64
61
|
auth_tokens = netrc_client.authenticators(self._base_url)
|
|
65
62
|
if not auth_tokens:
|
|
66
|
-
raise ValueError(
|
|
63
|
+
raise ValueError(
|
|
64
|
+
f"The '{self._base_url}' host name is not found in netrc file."
|
|
65
|
+
)
|
|
67
66
|
return auth_tokens[2]
|
|
68
67
|
|
|
69
68
|
def get_endpoint_url(self, endpoint):
|
|
@@ -80,8 +80,9 @@ class GerritChange(GerritBase):
|
|
|
80
80
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#merge-patch-set-input
|
|
81
81
|
:return:
|
|
82
82
|
"""
|
|
83
|
-
return self.gerrit.post(
|
|
84
|
-
|
|
83
|
+
return self.gerrit.post(
|
|
84
|
+
self.endpoint + "/merge", json=input_, headers=self.gerrit.default_headers
|
|
85
|
+
)
|
|
85
86
|
|
|
86
87
|
def set_commit_message(self, input_):
|
|
87
88
|
"""
|
|
@@ -100,8 +101,9 @@ class GerritChange(GerritBase):
|
|
|
100
101
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-message-input
|
|
101
102
|
:return:
|
|
102
103
|
"""
|
|
103
|
-
return self.gerrit.put(
|
|
104
|
-
|
|
104
|
+
return self.gerrit.put(
|
|
105
|
+
self.endpoint + "/message", json=input_, headers=self.gerrit.default_headers
|
|
106
|
+
)
|
|
105
107
|
|
|
106
108
|
def list_votes(self, account):
|
|
107
109
|
"""
|
|
@@ -163,8 +165,9 @@ class GerritChange(GerritBase):
|
|
|
163
165
|
:return:
|
|
164
166
|
"""
|
|
165
167
|
input_ = {"topic": topic}
|
|
166
|
-
return self.gerrit.put(
|
|
167
|
-
|
|
168
|
+
return self.gerrit.put(
|
|
169
|
+
self.endpoint + "/topic", json=input_, headers=self.gerrit.default_headers
|
|
170
|
+
)
|
|
168
171
|
|
|
169
172
|
def delete_topic(self):
|
|
170
173
|
"""
|
|
@@ -199,8 +202,11 @@ class GerritChange(GerritBase):
|
|
|
199
202
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#assignee-input
|
|
200
203
|
:return:
|
|
201
204
|
"""
|
|
202
|
-
result = self.gerrit.put(
|
|
203
|
-
|
|
205
|
+
result = self.gerrit.put(
|
|
206
|
+
self.endpoint + "/assignee",
|
|
207
|
+
json=input_,
|
|
208
|
+
headers=self.gerrit.default_headers,
|
|
209
|
+
)
|
|
204
210
|
return result
|
|
205
211
|
|
|
206
212
|
def get_past_assignees(self):
|
|
@@ -272,8 +278,9 @@ class GerritChange(GerritBase):
|
|
|
272
278
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#rebase-input
|
|
273
279
|
:return:
|
|
274
280
|
"""
|
|
275
|
-
return self.gerrit.post(
|
|
276
|
-
|
|
281
|
+
return self.gerrit.post(
|
|
282
|
+
self.endpoint + "/rebase", json=input_, headers=self.gerrit.default_headers
|
|
283
|
+
)
|
|
277
284
|
|
|
278
285
|
def move(self, input_):
|
|
279
286
|
"""
|
|
@@ -294,9 +301,9 @@ class GerritChange(GerritBase):
|
|
|
294
301
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#move-input
|
|
295
302
|
:return:
|
|
296
303
|
"""
|
|
297
|
-
return self.gerrit.post(
|
|
298
|
-
|
|
299
|
-
|
|
304
|
+
return self.gerrit.post(
|
|
305
|
+
self.endpoint + "/move", json=input_, headers=self.gerrit.default_headers
|
|
306
|
+
)
|
|
300
307
|
|
|
301
308
|
def revert(self, input_=None):
|
|
302
309
|
"""
|
|
@@ -328,8 +335,11 @@ class GerritChange(GerritBase):
|
|
|
328
335
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revert-input
|
|
329
336
|
:return:
|
|
330
337
|
"""
|
|
331
|
-
return self.gerrit.post(
|
|
332
|
-
|
|
338
|
+
return self.gerrit.post(
|
|
339
|
+
self.endpoint + "/revert",
|
|
340
|
+
json=input_ or {},
|
|
341
|
+
headers=self.gerrit.default_headers,
|
|
342
|
+
)
|
|
333
343
|
|
|
334
344
|
def revert_submission(self):
|
|
335
345
|
"""
|
|
@@ -372,8 +382,9 @@ class GerritChange(GerritBase):
|
|
|
372
382
|
if input_ is None:
|
|
373
383
|
result = self.gerrit.post(endpoint)
|
|
374
384
|
else:
|
|
375
|
-
result = self.gerrit.post(
|
|
376
|
-
|
|
385
|
+
result = self.gerrit.post(
|
|
386
|
+
endpoint, json=input_, headers=self.gerrit.default_headers
|
|
387
|
+
)
|
|
377
388
|
return result
|
|
378
389
|
|
|
379
390
|
def list_submitted_together_changes(self):
|
|
@@ -382,7 +393,9 @@ class GerritChange(GerritBase):
|
|
|
382
393
|
including the current change itself.
|
|
383
394
|
|
|
384
395
|
"""
|
|
385
|
-
return self.gerrit.get(
|
|
396
|
+
return self.gerrit.get(
|
|
397
|
+
self.endpoint + "/submitted_together?o=NON_VISIBLE_CHANGES"
|
|
398
|
+
)
|
|
386
399
|
|
|
387
400
|
def delete(self):
|
|
388
401
|
"""
|
|
@@ -469,7 +482,9 @@ class GerritChange(GerritBase):
|
|
|
469
482
|
if input_ is None:
|
|
470
483
|
result = self.gerrit.post(endpoint)
|
|
471
484
|
else:
|
|
472
|
-
result = self.gerrit.post(
|
|
485
|
+
result = self.gerrit.post(
|
|
486
|
+
endpoint, json=input_, headers=self.gerrit.default_headers
|
|
487
|
+
)
|
|
473
488
|
return result
|
|
474
489
|
|
|
475
490
|
def set_work_in_progress(self, input_=None):
|
|
@@ -496,9 +511,11 @@ class GerritChange(GerritBase):
|
|
|
496
511
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#work-in-progress-input
|
|
497
512
|
:return:
|
|
498
513
|
"""
|
|
499
|
-
self.gerrit.post(
|
|
500
|
-
|
|
501
|
-
|
|
514
|
+
self.gerrit.post(
|
|
515
|
+
self.endpoint + "/wip",
|
|
516
|
+
json=input_ or {},
|
|
517
|
+
headers=self.gerrit.default_headers,
|
|
518
|
+
)
|
|
502
519
|
|
|
503
520
|
def set_ready_for_review(self, input_):
|
|
504
521
|
"""
|
|
@@ -520,7 +537,9 @@ class GerritChange(GerritBase):
|
|
|
520
537
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#work-in-progress-input
|
|
521
538
|
:return:
|
|
522
539
|
"""
|
|
523
|
-
self.gerrit.post(
|
|
540
|
+
self.gerrit.post(
|
|
541
|
+
self.endpoint + "/ready", json=input_, headers=self.gerrit.default_headers
|
|
542
|
+
)
|
|
524
543
|
|
|
525
544
|
def mark_private(self, input_):
|
|
526
545
|
"""
|
|
@@ -539,9 +558,9 @@ class GerritChange(GerritBase):
|
|
|
539
558
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#private-input
|
|
540
559
|
:return:
|
|
541
560
|
"""
|
|
542
|
-
self.gerrit.post(
|
|
543
|
-
|
|
544
|
-
|
|
561
|
+
self.gerrit.post(
|
|
562
|
+
self.endpoint + "/private", json=input_, headers=self.gerrit.default_headers
|
|
563
|
+
)
|
|
545
564
|
|
|
546
565
|
def unmark_private(self, input_=None):
|
|
547
566
|
"""
|
|
@@ -565,9 +584,11 @@ class GerritChange(GerritBase):
|
|
|
565
584
|
if input_ is None:
|
|
566
585
|
self.gerrit.delete(self.endpoint + "/private")
|
|
567
586
|
else:
|
|
568
|
-
self.gerrit.post(
|
|
569
|
-
|
|
570
|
-
|
|
587
|
+
self.gerrit.post(
|
|
588
|
+
self.endpoint + "/private.delete",
|
|
589
|
+
json=input_,
|
|
590
|
+
headers=self.gerrit.default_headers,
|
|
591
|
+
)
|
|
571
592
|
|
|
572
593
|
def ignore(self):
|
|
573
594
|
"""
|
|
@@ -632,8 +653,11 @@ class GerritChange(GerritBase):
|
|
|
632
653
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#hashtags-input
|
|
633
654
|
:return:
|
|
634
655
|
"""
|
|
635
|
-
return self.gerrit.post(
|
|
636
|
-
|
|
656
|
+
return self.gerrit.post(
|
|
657
|
+
self.endpoint + "/hashtags",
|
|
658
|
+
json=input_,
|
|
659
|
+
headers=self.gerrit.default_headers,
|
|
660
|
+
)
|
|
637
661
|
|
|
638
662
|
@property
|
|
639
663
|
def messages(self):
|
|
@@ -647,8 +671,11 @@ class GerritChange(GerritBase):
|
|
|
647
671
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-input
|
|
648
672
|
:return:
|
|
649
673
|
"""
|
|
650
|
-
return self.gerrit.post(
|
|
651
|
-
|
|
674
|
+
return self.gerrit.post(
|
|
675
|
+
self.endpoint + "/check.submit_requirement",
|
|
676
|
+
json=input_,
|
|
677
|
+
headers=self.gerrit.default_headers,
|
|
678
|
+
)
|
|
652
679
|
|
|
653
680
|
def get_edit(self):
|
|
654
681
|
"""
|
|
@@ -724,9 +751,7 @@ class GerritChange(GerritBase):
|
|
|
724
751
|
return None
|
|
725
752
|
|
|
726
753
|
return GerritChangeRevision(
|
|
727
|
-
gerrit=self.gerrit,
|
|
728
|
-
change=self.id,
|
|
729
|
-
revision=revision_id
|
|
754
|
+
gerrit=self.gerrit, change=self.id, revision=revision_id
|
|
730
755
|
)
|
|
731
756
|
|
|
732
757
|
def get_attention_set(self):
|
|
@@ -759,8 +784,11 @@ class GerritChange(GerritBase):
|
|
|
759
784
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-input
|
|
760
785
|
:return:
|
|
761
786
|
"""
|
|
762
|
-
result = self.gerrit.post(
|
|
763
|
-
|
|
787
|
+
result = self.gerrit.post(
|
|
788
|
+
self.endpoint + "/attention",
|
|
789
|
+
json=input_,
|
|
790
|
+
headers=self.gerrit.default_headers,
|
|
791
|
+
)
|
|
764
792
|
return result
|
|
765
793
|
|
|
766
794
|
def remove_from_attention_set(self, id_, input_=None):
|
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
import logging
|
|
5
5
|
import requests
|
|
6
6
|
from gerrit.changes.change import GerritChange
|
|
7
|
-
from gerrit.utils.exceptions import
|
|
8
|
-
ChangeNotFoundError,
|
|
9
|
-
GerritAPIException
|
|
10
|
-
)
|
|
7
|
+
from gerrit.utils.exceptions import ChangeNotFoundError, GerritAPIException
|
|
11
8
|
|
|
12
9
|
|
|
13
10
|
logger = logging.getLogger(__name__)
|
|
@@ -94,7 +91,9 @@ class GerritChanges:
|
|
|
94
91
|
project = self.gerrit.projects.get(project_name)
|
|
95
92
|
project.branches.get(branch_name)
|
|
96
93
|
|
|
97
|
-
result = self.gerrit.post(
|
|
94
|
+
result = self.gerrit.post(
|
|
95
|
+
self.endpoint + "/", json=input_, headers=self.gerrit.default_headers
|
|
96
|
+
)
|
|
98
97
|
return result
|
|
99
98
|
|
|
100
99
|
def delete(self, id_):
|
|
@@ -10,7 +10,9 @@ class GerritChangeRevisionComment(GerritBase):
|
|
|
10
10
|
self.change = change
|
|
11
11
|
self.revision = revision
|
|
12
12
|
self.gerrit = gerrit
|
|
13
|
-
self.endpoint =
|
|
13
|
+
self.endpoint = (
|
|
14
|
+
f"/changes/{self.change}/revisions/{self.revision}/comments/{self.id}"
|
|
15
|
+
)
|
|
14
16
|
super().__init__(self)
|
|
15
17
|
|
|
16
18
|
def __str__(self):
|
|
@@ -42,8 +44,11 @@ class GerritChangeRevisionComment(GerritBase):
|
|
|
42
44
|
if input_ is None:
|
|
43
45
|
return self.gerrit.delete(self.endpoint)
|
|
44
46
|
else:
|
|
45
|
-
return self.gerrit.post(
|
|
46
|
-
|
|
47
|
+
return self.gerrit.post(
|
|
48
|
+
self.endpoint + "/delete",
|
|
49
|
+
json=input_,
|
|
50
|
+
headers=self.gerrit.default_headers,
|
|
51
|
+
)
|
|
47
52
|
|
|
48
53
|
|
|
49
54
|
class GerritChangeRevisionComments:
|
|
@@ -10,7 +10,9 @@ class GerritChangeRevisionDraft(GerritBase):
|
|
|
10
10
|
self.change = change
|
|
11
11
|
self.revision = revision
|
|
12
12
|
self.gerrit = gerrit
|
|
13
|
-
self.endpoint =
|
|
13
|
+
self.endpoint = (
|
|
14
|
+
f"/changes/{self.change}/revisions/{self.revision}/drafts/{self.id}"
|
|
15
|
+
)
|
|
14
16
|
super().__init__(self)
|
|
15
17
|
|
|
16
18
|
def __str__(self):
|
|
@@ -36,7 +38,9 @@ class GerritChangeRevisionDraft(GerritBase):
|
|
|
36
38
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-input
|
|
37
39
|
:return:
|
|
38
40
|
"""
|
|
39
|
-
return self.gerrit.put(
|
|
41
|
+
return self.gerrit.put(
|
|
42
|
+
self.endpoint, json=input_, headers=self.gerrit.default_headers
|
|
43
|
+
)
|
|
40
44
|
|
|
41
45
|
def delete(self):
|
|
42
46
|
"""
|
|
@@ -103,7 +107,9 @@ class GerritChangeRevisionDrafts:
|
|
|
103
107
|
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-input
|
|
104
108
|
:return:
|
|
105
109
|
"""
|
|
106
|
-
result = self.gerrit.put(
|
|
110
|
+
result = self.gerrit.put(
|
|
111
|
+
self.endpoint, json=input_, headers=self.gerrit.default_headers
|
|
112
|
+
)
|
|
107
113
|
return result
|
|
108
114
|
|
|
109
115
|
def delete(self, id_):
|