Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have option for Marge to automatically remove WIP status of branches to merge #68

Closed
trickl opened this issue Nov 29, 2017 · 5 comments
Closed

Comments

@trickl
Copy link

trickl commented Nov 29, 2017

By default, branches named "wip_" will get rejected by Marge as the merge request that is generated will start with "wip" and be marked in progress.

https://docs.gitlab.com/ce/user/project/merge_requests/work_in_progress_merge_requests.html

Typically developers will work on a development branch and label it as "wip_" to distinguish it from production branches, then decide to Marge it - in which case they will expect Marge to remove the WIP tag. Presently, their work flow would have to be:

  1. Create development branch (wip...)
  2. Submit MR
  3. Watch MR get rejected unexpected by Marge as its WIP.
  4. Rename their branch after figuring out the problem.
  5. Resubmit

This is less than ideal and could be solved if Marge automatically removed the WIP tag. As some teams might actually want this protection in place, I would make it an optional setting of Marge so teams can decide the behaviour they want.

@jcpetruzza
Copy link
Contributor

Ok, some minor clarifications:

  • In GitLab, if the title of the merge request starts with "WIP", then the MR is considered work-in-progress and it is not possible to merge it (neither using the Merge button nor the REST Api) until this is resolved by editing the title and removing the "WIP" part. I.e., you don't need to rename your branch to resolve this.
  • GitLab also added a feature where if the branch you use to create the merge request starts with wip_, then it marks the merge request as work-in-progress, which you resolve, again removing the WIP from the title. The same will happen if you push a fixup commit.
  • At the moment, when marge picks a merge request to process, it first checks if it is marked as WIP by gitlab and in that case it bails out immediately leaving a message about it. The rationale is that you don't want to wait until CI passes to find out that you can't merge the branch.
  • So, from the point of view of marge the name of the branch is irrelevant, the only thing that matters is whether the merge request that was assigned to her is currently marked as WIP or not.

We could make it so that, when ran with a certain flag, marge will simply edit the title to remove the WIP tag and then just merge the request. It would be a relatively simple fix. But I wonder if this would be a sane setting: the WIP is a protection that is there in order to prevent someone to merge a branch that the author thought was not ready. Developers opt-in to this feature by prefixing their branches with wip_ or by putting WIP on the title of their MR. If one were to run marge with this flag, individual developers could no longer opt to use it, since marge will just ignore.

However, I wonder if the annoying bit here is that a long time may happen between you assign the request to marge and you get the notification saying "can't merge, the branch is WIP", since other requests may have to be merged before this happens. And, again, once you react, you need to wait until your branch gets to be merged again. So maybe having marge continuously polling branches assigned to her and unassigning herself immediately in case the branch is WIP would be a good enough behaviour? What do you think?

@trickl
Copy link
Author

trickl commented Nov 29, 2017 via email

@jcpetruzza
Copy link
Contributor

I think you are correct... partly.

If the branch is called foo_bar_1234 and contains more than one commit, then gitlab will suggest foo bar 1234 as title for the merge request. Then you get as a not-sure-if-intended side effect that if your branch was called wip_foo_bar_1234, then the proposed title will be wip foo bar 1234 and if you just press "Create", your merge request will be marked as WIP (since the title starts with wip). It is true though that gitlab will automatically mark the MR as WIP if you later push additional fixup commits.

The association between branch name and merge request
title is solely due to Marge.

This part is definitely not the case. Marge has nothing to do with the creation of merge requests, that's all vanilla gitlab functionality. Everything that happens before you assign Marge's user to a merge request is outside of her domain.

@trickl
Copy link
Author

trickl commented Nov 30, 2017 via email

@jcpetruzza
Copy link
Contributor

I'm closing this issue in favour of #69 which I think would solve the issue with a better UX. Feel free to reopen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants