| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4ec8975 commit e901f44
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -145,3 +145,11 @@ Reset spent time for an issue:: | |||
| 145 | 145 | Get user agent detail for the issue (admin only):: | |
| 146 | 146 | ||
| 147 | 147 | detail = issue.user_agent_detail() | |
| 148 | + | ||
| 149 | + Get the list of merge requests that will close an issue when merged:: | ||
| 150 | + | ||
| 151 | + mrs = issue.closed_by() | ||
| 152 | + | ||
| 153 | + Get the list of participants:: | ||
| 154 | + | ||
| 155 | + users = issue.participants() | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -545,3 +545,29 @@ def reset_spent_time(self, **kwargs): | |||
| 545 | 545 | """ | |
| 546 | 546 | path = '%s/%s/reset_spent_time' % (self.manager.path, self.get_id()) | |
| 547 | 547 | return self.manager.gitlab.http_post(path, **kwargs) | |
| 548 | + | ||
| 549 | + | ||
| 550 | + class ParticipantsMixin(object): | ||
| 551 | + @cli.register_custom_action('ProjectMergeRequest', 'ProjectIssue') | ||
| 552 | + @exc.on_http_error(exc.GitlabListError) | ||
| 553 | + def participants(self, **kwargs): | ||
| 554 | + """List the participants. | ||
| 555 | + | ||
| 556 | + Args: | ||
| 557 | + all (bool): If True, return all the items, without pagination | ||
| 558 | + per_page (int): Number of items to retrieve per request | ||
| 559 | + page (int): ID of the page to return (starts with page 1) | ||
| 560 | + as_list (bool): If set to False and no pagination option is | ||
| 561 | + defined, return a generator instead of a list | ||
| 562 | + **kwargs: Extra options to send to the server (e.g. sudo) | ||
| 563 | + | ||
| 564 | + Raises: | ||
| 565 | + GitlabAuthenticationError: If authentication is not correct | ||
| 566 | + GitlabListError: If the list could not be retrieved | ||
| 567 | + | ||
| 568 | + Returns: | ||
| 569 | + RESTObjectList: The list of participants | ||
| 570 | + """ | ||
| 571 | + | ||
| 572 | + path = '%s/%s/participants' % (self.manager.path, self.get_id()) | ||
| 573 | + return self.manager.gitlab.http_get(path, **kwargs) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -542,7 +542,10 @@ class GroupIssueManager(ListMixin, RESTManager): | |||
| 542 | 542 | _path = '/groups/%(group_id)s/issues' | |
| 543 | 543 | _obj_cls = GroupIssue | |
| 544 | 544 | _from_parent_attrs = {'group_id': 'id'} | |
| 545 | - _list_filters = ('state', 'labels', 'milestone', 'order_by', 'sort') | ||
| 545 | + _list_filters = ('state', 'labels', 'milestone', 'order_by', 'sort', | ||
| 546 | + 'iids', 'author_id', 'assignee_id', 'my_reaction_emoji', | ||
| 547 | + 'search', 'created_after', 'created_before', | ||
| 548 | + 'updated_after', 'updated_before') | ||
| 546 | 549 | _types = {'labels': types.ListAttribute} | |
| 547 | 550 | ||
| 548 | 551 | ||
@@ -772,7 +775,10 @@ class Issue(RESTObject): | |||
| 772 | 775 | class IssueManager(ListMixin, RESTManager): | |
| 773 | 776 | _path = '/issues' | |
| 774 | 777 | _obj_cls = Issue | |
| 775 | - _list_filters = ('state', 'labels', 'order_by', 'sort') | ||
| 778 | + _list_filters = ('state', 'labels', 'milestone', 'scope', 'author_id', | ||
| 779 | + 'assignee_id', 'my_reaction_emoji', 'iids', 'order_by', | ||
| 780 | + 'sort', 'search', 'created_after', 'created_before', | ||
| 781 | + 'updated_after', 'updated_before') | ||
| 776 | 782 | _types = {'labels': types.ListAttribute} | |
| 777 | 783 | ||
| 778 | 784 | ||
@@ -1440,8 +1446,8 @@ class ProjectIssueDiscussionManager(RetrieveMixin, CreateMixin, RESTManager): | |||
| 1440 | 1446 | ||
| 1441 | 1447 | ||
| 1442 | 1448 | class ProjectIssue(UserAgentDetailMixin, SubscribableMixin, TodoMixin, | |
| 1443 | - TimeTrackingMixin, SaveMixin, ObjectDeleteMixin, | ||
| 1444 | - RESTObject): | ||
| 1449 | + TimeTrackingMixin, ParticipantsMixin, SaveMixin, | ||
| 1450 | + ObjectDeleteMixin, RESTObject): | ||
| 1445 | 1451 | _short_print_attr = 'title' | |
| 1446 | 1452 | _id_attr = 'iid' | |
| 1447 | 1453 | _managers = ( | |
@@ -1469,18 +1475,42 @@ def move(self, to_project_id, **kwargs): | |||
| 1469 | 1475 | **kwargs) | |
| 1470 | 1476 | self._update_attrs(server_data) | |
| 1471 | 1477 | ||
| 1478 | + @cli.register_custom_action('ProjectIssue') | ||
| 1479 | + @exc.on_http_error(exc.GitlabGetError) | ||
| 1480 | + def closed_by(self, **kwargs): | ||
| 1481 | + """List merge requests that will close the issue when merged. | ||
| 1482 | + | ||
| 1483 | + Args: | ||
| 1484 | + **kwargs: Extra options to send to the server (e.g. sudo) | ||
| 1485 | + | ||
| 1486 | + Raises: | ||
| 1487 | + GitlabAuthenticationError: If authentication is not correct | ||
| 1488 | + GitlabGetErrot: If the merge requests could not be retrieved | ||
| 1489 | + | ||
| 1490 | + Returns: | ||
| 1491 | + list: The list of merge requests. | ||
| 1492 | + """ | ||
| 1493 | + path = '%s/%s/closed_by' % (self.manager.path, self.get_id()) | ||
| 1494 | + return self.manager.gitlab.http_get(path, **kwargs) | ||
| 1495 | + | ||
| 1472 | 1496 | ||
| 1473 | 1497 | class ProjectIssueManager(CRUDMixin, RESTManager): | |
| 1474 | 1498 | _path = '/projects/%(project_id)s/issues/' | |
| 1475 | 1499 | _obj_cls = ProjectIssue | |
| 1476 | 1500 | _from_parent_attrs = {'project_id': 'id'} | |
| 1477 | - _list_filters = ('state', 'labels', 'milestone', 'order_by', 'sort') | ||
| 1501 | + _list_filters = ('iids', 'state', 'labels', 'milestone', 'scope', | ||
| 1502 | + 'author_id', 'assignee_id', 'my_reaction_emoji', | ||
| 1503 | + 'order_by', 'sort', 'search', 'created_after', | ||
| 1504 | + 'created_before', 'updated_after', 'updated_before') | ||
| 1478 | 1505 | _create_attrs = (('title', ), | |
| 1479 | - ('description', 'assignee_id', 'milestone_id', 'labels', | ||
| 1480 | - 'created_at', 'due_date')) | ||
| 1481 | - _update_attrs = (tuple(), ('title', 'description', 'assignee_id', | ||
| 1482 | - 'milestone_id', 'labels', 'created_at', | ||
| 1483 | - 'updated_at', 'state_event', 'due_date')) | ||
| 1506 | + ('description', 'confidential', 'assignee_id', | ||
| 1507 | + 'assignee_idss' 'milestone_id', 'labels', 'created_at', | ||
| 1508 | + 'due_date', 'merge_request_to_resolve_discussions_of' , | ||
| 1509 | + 'discussion_to_resolve')) | ||
| 1510 | + _update_attrs = (tuple(), ('title', 'description', 'confidential', | ||
| 1511 | + 'assignee_ids', 'assignee_id', 'milestone_id', | ||
| 1512 | + 'labels', 'state_event', 'updated_at', | ||
| 1513 | + 'due_date', 'discussion_locked')) | ||
| 1484 | 1514 | _types = {'labels': types.ListAttribute} | |
| 1485 | 1515 | ||
| 1486 | 1516 | ||
@@ -1655,7 +1685,8 @@ class ProjectMergeRequestDiscussionManager(RetrieveMixin, CreateMixin, | |||
| 1655 | 1685 | ||
| 1656 | 1686 | ||
| 1657 | 1687 | class ProjectMergeRequest(SubscribableMixin, TodoMixin, TimeTrackingMixin, | |
| 1658 | - SaveMixin, ObjectDeleteMixin, RESTObject): | ||
| 1688 | + ParticipantsMixin, SaveMixin, ObjectDeleteMixin, | ||
| 1689 | + RESTObject): | ||
| 1659 | 1690 | _id_attr = 'iid' | |
| 1660 | 1691 | ||
| 1661 | 1692 | _managers = ( | |
@@ -1793,30 +1824,6 @@ def merge(self, merge_commit_message=None, | |||
| 1793 | 1824 | **kwargs) | |
| 1794 | 1825 | self._update_attrs(server_data) | |
| 1795 | 1826 | ||
| 1796 | - @cli.register_custom_action('ProjectMergeRequest') | ||
| 1797 | - @exc.on_http_error(exc.GitlabListError) | ||
| 1798 | - def participants(self, **kwargs): | ||
| 1799 | - """List the merge request participants. | ||
| 1800 | - | ||
| 1801 | - Args: | ||
| 1802 | - all (bool): If True, return all the items, without pagination | ||
| 1803 | - per_page (int): Number of items to retrieve per request | ||
| 1804 | - page (int): ID of the page to return (starts with page 1) | ||
| 1805 | - as_list (bool): If set to False and no pagination option is | ||
| 1806 | - defined, return a generator instead of a list | ||
| 1807 | - **kwargs: Extra options to send to the server (e.g. sudo) | ||
| 1808 | - | ||
| 1809 | - Raises: | ||
| 1810 | - GitlabAuthenticationError: If authentication is not correct | ||
| 1811 | - GitlabListError: If the list could not be retrieved | ||
| 1812 | - | ||
| 1813 | - Returns: | ||
| 1814 | - RESTObjectList: The list of participants | ||
| 1815 | - """ | ||
| 1816 | - | ||
| 1817 | - path = '%s/%s/participants' % (self.manager.path, self.get_id()) | ||
| 1818 | - return self.manager.gitlab.http_get(path, **kwargs) | ||
| 1819 | - | ||
| 1820 | 1827 | ||
| 1821 | 1828 | class ProjectMergeRequestManager(CRUDMixin, RESTManager): | |
| 1822 | 1829 | _path = '/projects/%(project_id)s/merge_requests' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -511,6 +511,7 @@ | |||
| 511 | 511 | assert(isinstance(issue1.user_agent_detail(), dict)) | |
| 512 | 512 | ||
| 513 | 513 | assert(issue1.user_agent_detail()['user_agent']) | |
| 514 | + assert(issue1.participants()) | ||
| 514 | 515 | ||
| 515 | 516 | discussion = issue1.discussions.create({'body': 'Discussion body'}) | |
| 516 | 517 | assert(len(issue1.discussions.list()) == 1) | |
@@ -604,7 +605,7 @@ | |||
| 604 | 605 | # basic testing: only make sure that the methods exist | |
| 605 | 606 | mr.commits() | |
| 606 | 607 | mr.changes() | |
| 607 | - mr.participants() # not yet available | ||
| 608 | + assert(mr.participants()) | ||
| 608 | 609 | ||
| 609 | 610 | mr.merge() | |
| 610 | 611 | admin_project.branches.delete('branch1') | |
| Back | FazBrowse Home | New Git URL |
0 commit comments