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

feat(api): add project milestone promotion#1655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nejch merged 1 commit intopython-gitlab:mainfromStingRayZA:add-milestone-promote
Oct 31, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletionsdocs/gl_objects/milestones.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,6 +66,10 @@ Change the state of a milestone (activate / close)::
milestone.state_event = 'activate'
milestone.save()

Promote a project milestone::

milestone.promote()

List the issues related to a milestone::

issues = milestone.issues()
Expand Down
5 changes: 3 additions & 2 deletionsgitlab/v4/objects/milestones.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@
from gitlab import exceptions as exc
from gitlab import types
from gitlab.base import RequiredOptional, RESTManager, RESTObject, RESTObjectList
from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
from gitlab.mixins import CRUDMixin, ObjectDeleteMixin,PromoteMixin,SaveMixin

from .issues import GroupIssue, GroupIssueManager, ProjectIssue, ProjectIssueManager
from .merge_requests import (
Expand DownExpand Up@@ -90,8 +90,9 @@ class GroupMilestoneManager(CRUDMixin, RESTManager):
_types = {"iids": types.ListAttribute}


class ProjectMilestone(SaveMixin, ObjectDeleteMixin, RESTObject):
class ProjectMilestone(PromoteMixin,SaveMixin, ObjectDeleteMixin, RESTObject):
_short_print_attr = "title"
_update_uses_post = True

@cli.register_custom_action("ProjectMilestone")
@exc.on_http_error(exc.GitlabListError)
Expand Down
21 changes: 21 additions & 0 deletionstests/functional/api/test_projects.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -199,6 +199,27 @@ def test_project_milestones(project):
assert len(milestone.merge_requests()) == 0


def test_project_milestone_promotion(gl, group):
"""
Milestone promotion requires the project to be a child of a group (not in a user namespace)

"""
_id = uuid.uuid4().hex
data = {
"name": f"test-project-{_id}",
"namespace_id": group.id,
}
project = gl.projects.create(data)

milestone_title = "promoteme"
promoted_milestone = project.milestones.create({"title": milestone_title})
promoted_milestone.promote()

assert any(
milestone.title == milestone_title for milestone in group.milestones.list()
)


def test_project_pages_domains(gl, project):
domain = project.pagesdomains.create({"domain": "foo.domain.com"})
assert len(project.pagesdomains.list()) == 1
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp