Show divergence counts for a fork on project page
What does this MR do and why?
The fork may have 4 states:
- Fork is up to date
- Fork is behind upstream
- Fork is ahead of upstream
- Fork is behind and ahead of upstream
This commit fetches the fork's branch into the source repo and calculates the divergence counts
Related issue: #14491 (closed)
Test locally
Enable fork_divergence_counts
feature flag:
Feature.enable(:fork_divergence_counts)
- Fork a project
- Visit the fork project page
- If no commits were pushed to the upstream, the
Up to date with upstream repository
message must be shown:
- Push a commit/multiple commits to the upstream project
- The message will show that the project is N commits behind the upstream
- Push a commit/multiple commits to the fork
- The message will show that the project is N commits ahead of the upstream
- It is expected that a user creates a fork in order to propose changes to the upstream default branch. That's why we always compare with the default branch. Having said that, in order to test the behavior, it is sufficient to play with the ref dropdown:
Edited by Igor Drozdov