How to do a code review for many commits in gitlab? - gitlab

What is the easiest/best way to review a merge request in gitlab for a branch that has many commits?
Is there a “unified” view I can use somehow or is the only option to click on the “Changes” tab and go through each individual commits one by one?

You do not need to go through each invidividual commit one by one.
You should click on the Merge Request's "Changes" tab, instead of the "Changes" tab of individual commits, so you see the changes between the latest version and the branch you want to merge into, e.g. with Master:
This way, you will see all changes that are proposed within the merge request and you can review them all at once.

Related

Draft merge request in GitLab is two commits behind--click "Mark as ready", or pull/rebase first?

I need your help to determine the correct order events I should follow before I perform a specific type of merge in GitLab. I have a "Draft" merge request which has the prefix "Draft:" in its title, but has been approved by all its required code reviewers. At this point it says,
Merge blocked: merge request must be marked as ready. It's still marked as draft.
Beneath that there is a warning:
The source branch is 2 commits behind the target branch
The Merge button is disabled. A little exclamation point icon appears next to it. And there is a "Mark as ready" button that is enabled and I could click on.
Am I free to click "Mark as ready" at this point, or should I first clone that project locally, catch it up with its parent branch, and push it back up to the remote repository before I click "Mark as ready"?
The GitLab web UI actually made this process quite easy despite the fact that by the time I got around to this, I was 10 commits behind!
All I did was click "Mark as ready", which removed the "Draft:" prefix from the merge request title. Then the UI said it was "Ready to merge" with a green checkmark icon. Beneath that, it said, "3 commits and 1 merge commit will be added to develop".
I suppose that meant that whatever commits I was behind, it took care of merging/rebasing that in the background--or maybe GitLab didn't do anything and I was covered because the code in my draft merge's branch was either mutually exclusive (i.e., didn't conflict) with the develop branch or it already up to date with the develop branch. Any explanations/clarifications by other more experienced software engineers are welcome! I believe that if there had been a conflict, GitLab would have presented me with further options before merging.
The "3 commits" left here at this point certainly had to do with the actual code pushed into this specific merge request by the developer.
I then clicked the two checkboxes, "Delete source branch" and "Squash commits" (as a preference). The subtitle now reflected that "1 commit and 1 merge commit will be added to develop (squashes 3 commits)." Finally, I simply clicked "Merge".
Done.

How to select merge changes in gitlab

I have a pending merge request and I am attempting to merge 2 branches via gitlab. I can see changes but there is no option for me to accept which change I would like to have:
Could someone clarify to me how do I accept the changes that I want when merging via gitlab?
What you see is probably a diff view, not a merge view.
If there are conflicts, you should see a "Resolve conflict" in the MR page.
That should open a view with a "use this" button for you to chose one side or the other.

Show all changes made between a range of commits in GitLab UI

Say I have 10 commits in my merge request. I'd like to see all changes made between the first commit and the second to last commit. How can I see this in the GitLab UI?
You can view 'Changes' tab to view all changes in merge request
You can also click on individual commits to view what is changed in that particular commit
You can check diff between two arbitrary commits using https://gitlab.com/$USER/$REPO/compare?from=$SHA1&to=$SHA2
Reference:
https://stackoverflow.com/a/50070145/2073920
Use format
https://gitlab.com/$USER/$REPOSITORY/compare?from=commit_hashtag1&to=commit_hashtag2
For example, You use URL like this
https://gitlab.com/Donhu/java_examples/compare?from=7f844e6b&to=1ff5c89c

Perforce -Keep working on the project while the code is under review

I am a git person. In git, after I finishing a little feature, I will submit the branch to review and start a new branch to work on new features.
For example, I had submitted a code recview for feature A, and it is still under review. At this time, I want to start working on feature B, assuming feature A's code will be merged in the near future. In Git, typically I just create a new branch to work on the new feature, if there is some problem with feature A I can easily switch back to branch A to fix it and merge the fixed version to my new feature branch.
How's it achieved in perforce? Should I copy the whole code somewhere as a way to manage branch myself?
You can do this in Perforce exactly the same way you'd do it in Git, if you like -- create your feature B branch and work on feature B there. If you need to make changes to your feature A branch, those can be merged back to your mainline and/or your feature B branch.
If you do your code reviews as shelves, you can have any number of them in development at a time; a shelved change is effectively "rebased" onto submitted changes when you sync+resolve.
FWIW, usually the way I've done reviews in Perforce is to make my changes on my own development branch, set up the merge to the mainline, and then shelve that for review. That way I can continue work on my development branch uninterrupted, I don't need to create a new branch, and if there's a fix needed to my merge-in-progress I can just amend the shelved change (either by submitting the fix to my branch and adding it to the merge, or making the edit as part of the merge operation); it also has the benefit of making conflict resolution (if any) part of the change under review.

Keep Gitlab merge request asignee history

Since the last update of our self-hosted gitlab component, the assignee changes are not logged anymore on any merge request.
Just like so : (taken from Gitlab documentation)
Not only it allows to see the exact workflow but it can also gives informations on the timeline of these changes. All these were very helpfull.
I've searched in the changelog but it dosen't seem to be listed.
Here is my question :
Is it possible go get it back and if so, how ?
Thanks a lot in advance
You have probably hidden the activities. At the beginning of the events, where there are tabs for Discussion, Pipelines, Commits, and Changes, there is a dropdown where you can filter out some activities. You just need to select "Show all activity", or whatever fits you best

Resources