Comparison of a Pull Request Diff between Bitbucket Server and Data Center versions up to 6.x and from 7.x onwards
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
The Pull Request Diff experience has changed between all the Bitbucket versions up to 6.x and Bitbucket 7. As announced in the Bitbucket 7.0 Release Notes:
We’ve made the switch from a 3-way diff to a 2-way diff in pull requests. This means that from Bitbucket Server 7.0 and later, when viewing a pull request, the diff shown is one between the tip of the source branch and its common ancestor with the target branch. The UI will still indicate when a pull request has conflicts, but they will no longer be marked up in the diff. Use of a 2-way diff is an industry-standard and reduces CPU load on large instances.
What does it mean in action?
診断
Let's consider a repository with only one file in a master
branch:
This is a line in a master branch.
This is a line in a master branch.
This is a line in a master branch.
Let's create two branches out of the master
branch: branch_A
and branch_B
.
Now let's modify file.txt on both branches by updating different lines in each of them:
This is an edit in branch_A.
This is a line in a master branch.
This is a line in a master branch.
This is a line in a master branch.
This is an edit in branch_B.
This is a line in a master branch.
In the last step, let's create three Pull Requests in both Bitbucket 6.10 and Bitbucket 7.15:
branch_A
→master
branch_B
→master
branch_A
→branch_b
手順 | Bitbucket 7 | Bitbucket 6 |
---|---|---|
| ||
| ||
|
As you can see in the last comparison - in Bitbucket 6 the Pull Request Diff presents a direct comparison between branch_A
and branch_B
.
In Bitbucket 7 however, the comparison is presented between branch_A
(the source branch) and the common ancestor of both branch_A
and branch_B
, which in that particular case is the last commit in the master
branch. In other words - the last commit shared between the source and the target.
Please be advised that in both cases, a conflict was detected, as the same file was modified on source and destination.
原因
We have switched the way we calculate Pull Request Diffs from 3-way diffs to 2-way diffs. The change is permanent and there's no configurable parameter to bring the 3-way diff experience back.
More information on the change can be found in:
- Bitbucket 7.0 Release Notes
- The diff in pull requests is showing unrelated files after upgrade of Bitbucket Server or Data Center to 7.x KB
- A complex explanation from our Principal Developer
- An explanation in a Feature Request BSERV-7375 - Stash's branch compare starts at a common ancestor, so the diff shown is misleading
ソリューション
The example above is the expected behaviour in Bitbucket from version 7.0 onwards. Please make sure that your developers are aware of the change and adjust the internal processes accordingly.