1*4bcd95a3SBarry Smith(ch_submittingmr)= 2*4bcd95a3SBarry Smith 3*4bcd95a3SBarry Smith# Submitting a Merge Request 4*4bcd95a3SBarry Smith 5*4bcd95a3SBarry Smith`git push` prints a URL to the terminal that you can use to start a merge request. 6*4bcd95a3SBarry SmithAlternatively, use [GitLab's web interface](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html). 7*4bcd95a3SBarry Smith 8*4bcd95a3SBarry Smith- The default **target** branch is `main`; if your branch started from `release`, select that as the target branch. 9*4bcd95a3SBarry Smith- If the merge request resolves an outstanding [issue](https://gitlab.com/petsc/petsc/issues), 10*4bcd95a3SBarry Smith include a [closing pattern](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#default-closing-pattern) 11*4bcd95a3SBarry Smith such as `Closes #123` in the MR’s description to automatically have the issue closed when the MR is merged [^closing-patterns-release] . 12*4bcd95a3SBarry Smith 13*4bcd95a3SBarry SmithIf you are not contributing from a fork: 14*4bcd95a3SBarry Smith 15*4bcd95a3SBarry Smith- Select appropriate [labels](https://gitlab.com/petsc/petsc/-/labels) including a {any}`workflow label <sec_workflow_labels>`. 16*4bcd95a3SBarry Smith- Assign yourself to the MR. 17*4bcd95a3SBarry Smith- Select reviewers for the MR; clicking on `> Approval Rules` will list appropriate reviewers. 18*4bcd95a3SBarry Smith- If the branch started from `release` select the `milestone` of `Vxx.yy-release-fixes` 19*4bcd95a3SBarry Smith- For changes only to documentation, add the `docs-only` label, which will 20*4bcd95a3SBarry Smith trigger a modified pipeline to build a preview of the documentation automatically. 21*4bcd95a3SBarry Smith Any warnings from Sphinx will cause the pipeline to fail. Once completed, click "View App" on the right side in the middle of the MR page. 22*4bcd95a3SBarry Smith- If appropriate, once the MR has been submitted, refresh the browser and select Pipelines to examine and run testing; see doc:`/developers/contributing/pipelines`. 23*4bcd95a3SBarry Smith 24*4bcd95a3SBarry SmithFor MRs from forks: 25*4bcd95a3SBarry Smith 26*4bcd95a3SBarry Smith- Make sure the fork is public -- as GitLab merge request process does not work well with a private fork. 27*4bcd95a3SBarry Smith- Select the correct target repository `petsc/petsc` along with the target branch. 28*4bcd95a3SBarry Smith- Select the "Allow commits from members who can merge to the target branch" option. 29*4bcd95a3SBarry Smith- GitLab does not allow you to set labels, so `@`-mention one of the developers in a comment so they can assign someone to the MR to add labels, run pipelines, and generally assist with the MR. The assignee and submitter should be listed in the upper right corner as assignees to the MR. 30*4bcd95a3SBarry Smith 31*4bcd95a3SBarry Smith(sec_workflow_labels)= 32*4bcd95a3SBarry Smith 33*4bcd95a3SBarry Smith## Workflow labels 34*4bcd95a3SBarry Smith 35*4bcd95a3SBarry SmithThe MR process, including testing and reviewing, is managed by [workflow labels](https://gitlab.com/petsc/petsc/-/labels?subscribed=&search=workflow%3A%3A) that indicate the state of the MR. Every MR should have exactly one of these labels. 36*4bcd95a3SBarry Smith 37*4bcd95a3SBarry SmithThe standard workflow has three steps. 38*4bcd95a3SBarry Smith 39*4bcd95a3SBarry Smith- `workflow::Pipeline-Testing` The user is testing their branch. Generally, unless asked, no one else has a reason to look at such an MR. 40*4bcd95a3SBarry Smith- `workflow::Review` The user would like their branch reviewed. 41*4bcd95a3SBarry Smith- `workflow::Ready-For-Merge` The MR has passed all tests, passed the review, has no outstanding threads, and has a {any}`clean commit history <sec_clean_commit_history>`. 42*4bcd95a3SBarry Smith 43*4bcd95a3SBarry SmithThe submitter/assignee of the MR is responsible for changing the `workflow` label appropriately during the MR process. 44*4bcd95a3SBarry Smith 45*4bcd95a3SBarry SmithSome MRs may begin with either of the following `workflow` states. 46*4bcd95a3SBarry Smith 47*4bcd95a3SBarry Smith- `workflow::Request-For-Comment` The branch is not being requested to be merged, but the user would like feedback on the branch. You do not need to test the code in this state. 48*4bcd95a3SBarry Smith- `workflow::In-Development` The developer is working on the branch. Other developers not involved in the branch generally have no reason to look at these MRs. 49*4bcd95a3SBarry Smith 50*4bcd95a3SBarry SmithThese should also be marked as "Draft" on the MR page. 51*4bcd95a3SBarry SmithThe developer usually eventually converts these two states to `workflow::Review`. 52*4bcd95a3SBarry Smith 53*4bcd95a3SBarry SmithYou can run the pipelines on an MR in any workflow state. 54*4bcd95a3SBarry Smith 55*4bcd95a3SBarry Smith(sec_mr_reviewing)= 56*4bcd95a3SBarry Smith 57*4bcd95a3SBarry Smith## MR reviewing 58*4bcd95a3SBarry Smith 59*4bcd95a3SBarry SmithOnce the MR has passed the pipeline, it is ready for review. 60*4bcd95a3SBarry SmithThe submitter/assignee must change the {any}`workflow label <sec_workflow_labels>` to `workflow::Review`. 61*4bcd95a3SBarry Smith 62*4bcd95a3SBarry SmithIt is the **submitter/assignee’s** responsibility to track the progress of the MR 63*4bcd95a3SBarry Smithand ensure it gets merged. 64*4bcd95a3SBarry Smith 65*4bcd95a3SBarry SmithIf the pipeline detects problems, it is the **submitter/assignee’s** 66*4bcd95a3SBarry Smithresponsibility to fix the errors. 67*4bcd95a3SBarry Smith 68*4bcd95a3SBarry SmithReviewers comment on the MR, either 69*4bcd95a3SBarry Smith 70*4bcd95a3SBarry Smith- by clicking on the left end of a specific line in the `Changes` window. A useful feature is the ["insert suggestion"](https://docs.gitlab.com/ee/user/project/merge_requests/reviews/suggestions.html) button in the comment box, to suggest an exact replacement on a line or several adjacent lines. 71*4bcd95a3SBarry Smith- or in the overview if it is a general comment. When introducing a new topic (thread) in reviewing an MR, one should submit with "Start Review" and not "Comment". 72*4bcd95a3SBarry Smith 73*4bcd95a3SBarry SmithGitLab MRs use "threads" to track discussions. 74*4bcd95a3SBarry SmithWhen responding to a thread, make sure to use the "Reply" box for that 75*4bcd95a3SBarry Smiththread; do not introduce a new thread or a comment. 76*4bcd95a3SBarry Smith 77*4bcd95a3SBarry SmithThe **submitter/assignee** must mark threads as resolved when they fix the related 78*4bcd95a3SBarry Smithproblem. 79*4bcd95a3SBarry Smith 80*4bcd95a3SBarry SmithOften, the submitter/assignee will need to update their branch in response to these comments, 81*4bcd95a3SBarry Smithand re-run the pipeline. 82*4bcd95a3SBarry Smith 83*4bcd95a3SBarry SmithIf the **submitter/assignee** feels the MR is not getting reviewed in a timely 84*4bcd95a3SBarry Smithmanner, they may assign additional reviewers to the MR and request in the MR discussion these same people to review by @-mentioning them. 85*4bcd95a3SBarry Smith 86*4bcd95a3SBarry SmithWhen reviewers believe an MR is ready to be merged, they approve it. 87*4bcd95a3SBarry SmithYou can determine who must approve your MR by clicking on the "View eligible reviewers" towards the top of the "Overview" page. 88*4bcd95a3SBarry Smith 89*4bcd95a3SBarry SmithWhen a sufficient number of reviewers has approved the merge, the pipeline passes, new commits have been {any}`properly rearranged <sec_clean_commit_history>` if needed, and all threads have been resolved, 90*4bcd95a3SBarry Smiththe **submitter/assignee** must set the label to {any}`workflow::Ready-For-Merge <sec_workflow_labels>`. 91*4bcd95a3SBarry Smith 92*4bcd95a3SBarry Smith```{rubric} Footnotes 93*4bcd95a3SBarry Smith``` 94*4bcd95a3SBarry Smith 95*4bcd95a3SBarry Smith[^closing-patterns-release]: Unfortunately, these closing patterns [only work for MRs to a single default branch](https://gitlab.com/gitlab-org/gitlab/-/issues/14289) (`main`), so you must manually close related issues for MRs to `release`. 96