Skip to content

Commit

Permalink
cmd/mr: remote WIP terminology support
Browse files Browse the repository at this point in the history
GitLab is planning to fully remove the WIP word from their Draft status [1]
in their 14.0 version, which is about to be released. With that, we should
also error out when the user uses it for their merge requests prefixes.

```
Adding WIP: to the start of the merge request’s title still marks a merge
request as a draft.  This feature is scheduled for removal in GitLab 14.0.
Use Draft: instead.
```

[1] https://gitlab.com/gitlab-org/gitlab/-/issues/228685
[2] https://docs.gitlab.com/ee/user/project/merge_requests/drafts.html

Signed-off-by: Bruno Meneguele <[email protected]>
  • Loading branch information
bmeneg committed Jun 17, 2021
1 parent f8abe97 commit 68aea79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 8 additions & 3 deletions cmd/mr_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,17 @@ func runMRCreate(cmd *cobra.Command, args []string) {

draft, _ := cmd.Flags().GetBool("draft")
if draft {
isWIP := hasPrefix(title, "wip:")
// GitLab 14.0 will remove WIP support in favor of Draft
isWIP := hasPrefix(title, "wip:") ||
hasPrefix(title, "[wip]")
if isWIP {
log.Fatal("the use of \"WIP\" terminology is deprecated, use \"Draft\" instead")
}

isDraft := hasPrefix(title, "draft:") ||
hasPrefix(title, "[draft]") ||
hasPrefix(title, "(draft)")

if !isWIP && !isDraft {
if !isDraft {
title = "Draft: " + title
}
}
Expand Down
6 changes: 5 additions & 1 deletion cmd/mr_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ var mrEditCmd = &cobra.Command{
}

if draft {
if !isWIP && !isDraft {
if isWIP {
log.Fatal("the use of \"WIP\" terminology is deprecated, use \"Draft\" instead")
}

if !isDraft {
title = "Draft: " + title
}
}
Expand Down

0 comments on commit 68aea79

Please sign in to comment.