diff --git a/bugwarrior/docs/services/gitlab.rst b/bugwarrior/docs/services/gitlab.rst index dcc04b264..0ec5aae67 100644 --- a/bugwarrior/docs/services/gitlab.rst +++ b/bugwarrior/docs/services/gitlab.rst @@ -110,3 +110,5 @@ Provided UDA Fields +-----------------------+-----------------------+---------------------+ | ``gitlabdownvotes`` | Number of downvotes | Numeric | +-----------------------+-----------------------+---------------------+ +| ``gitlabwip`` | Work-in-Progress flag | Numeric | ++-----------------------+-----------------------+---------------------+ diff --git a/bugwarrior/services/gitlab.py b/bugwarrior/services/gitlab.py index 7f76383ab..1240d7374 100644 --- a/bugwarrior/services/gitlab.py +++ b/bugwarrior/services/gitlab.py @@ -22,6 +22,7 @@ class GitlabIssue(Issue): STATE = 'gitlabstate' UPVOTES = 'gitlabupvotes' DOWNVOTES = 'gitlabdownvotes' + WORK_IN_PROGRESS = 'gitlabwip' UDAS = { TITLE: { @@ -72,6 +73,10 @@ class GitlabIssue(Issue): 'type': 'numeric', 'label': 'Gitlab Downvotes', }, + WORK_IN_PROGRESS: { + 'type': 'numeric', + 'label': 'Gitlab MR Work-In-Progress Flag', + }, } UNIQUE_KEY = (REPO, TYPE, NUMBER,) @@ -87,6 +92,7 @@ def to_taskwarrior(self): state = self.record['state'] upvotes = self.record['upvotes'] downvotes = self.record['downvotes'] + work_in_progress = self.record.get('work_in_progress', 0) else: priority = self.origin['default_priority'] milestone = self.record['milestone'] @@ -95,6 +101,7 @@ def to_taskwarrior(self): state = self.record['state'] upvotes = 0 downvotes = 0 + work_in_progress = 0 if milestone: milestone = milestone['title'] @@ -121,6 +128,7 @@ def to_taskwarrior(self): self.STATE: state, self.UPVOTES: upvotes, self.DOWNVOTES: downvotes, + self.WORK_IN_PROGRESS: work_in_progress, } def get_tags(self): diff --git a/tests/test_gitlab.py b/tests/test_gitlab.py index 2fe974195..ccb90d645 100644 --- a/tests/test_gitlab.py +++ b/tests/test_gitlab.py @@ -54,7 +54,8 @@ class TestGitlabIssue(ServiceTest): }, "state": "opened", "updated_at": arbitrary_updated.isoformat(), - "created_at": arbitrary_created.isoformat() + "created_at": arbitrary_created.isoformat(), + "work_in_progress": True } arbitrary_extra = { 'issue_url': 'https://gitlab.example.com/arbitrary_username/project/issues/3', @@ -98,6 +99,7 @@ def test_to_taskwarrior(self): issue.MILESTONE: self.arbitrary_issue['milestone']['title'], issue.UPVOTES: 0, issue.DOWNVOTES: 0, + issue.WORK_IN_PROGRESS: 0, } actual_output = issue.to_taskwarrior()