Gerrit/Web チュートリアル

From mediawiki.org
This page is a translated version of the page Gerrit/Web tutorial and the translation is 29% complete.

Gerrit のウェブサイトを使用して、リポジトリの作成/変更と申請された変更のマージができます。 これは、これらの方法を説明するチュートリアルです。

Create a change

Gerrit にログイン済の場合は、ウェブ インターフェイス内で直接コード変更を作成できます。 これは、小さなパッチを作成したり、開発者ではない人が小さな修正を提供したりするのに便利です。

  1. https://gerrit.wikimedia.org/r/admin/repos/ へ進み、編集したいコードリポジトリを選択する。
  2. サイドバーで"Commands"を選択する
  3. "Create Change"をクリックする
  4. ブランチを"master"にセットする(masterブランチを使いたくないならば、そのプロジェクトで利用可能な他のブランチを使うことができます)
  5. トピックを任意のものに設定します (例: "copy-edit" - 1つに連結された文字列でなければならない) (省略可能)
  6. 大きなテキスト欄に、メッセージのガイドラインに従って説明文 (「コミットの概要」) を書きます。()
  7. "Create"をクリックする
  8. 右上隅にある、"Edit"ボタンをクリックする
  9. "Files"の下にある、"ADD/OPEN/UPLOAD"ボタンをクリックする
  10. Type the folder/file path for the file you wish to edit (e.g. i18n/en.json) and click "Confirm"
  11. Find the line(s) you want to change, and change them.
  12. "Save"をクリックする
  13. "Close"をクリックする
  14. "Publish edit"をクリックする
  15. Click "Mark as active" to remove the "Work in Progress" status from your code changes

Modify a change

To modify the files in a change, first click "Edit" in the upper right.

Then, to edit a file in a change, click "Actions" to the right of the file in the list and click "Add/Open/Upload".

To add a file to a change, click "ADD/OPEN/UPLOAD" under "Files".

When you're done, click "Stop Editing" in the upper right.

Comment on a file

Under Files, Expand All opens the diff for each file below. You can double-click on a line and then press the C key to comment on that line, then click "Save" to save the draft comment. Then, at the top of the page click the "Reply" button to publish your comment.

Parts of a change

The change has a few fields, links and buttons:

  • Assignee. An optional field to make a single person responsible for handling reviewing the changeset. This should only be set if the assignee has agreed.
  • Reviewers. 'jenkins-bot' is the autoreviewer that auto-verifies anything that passes the Jenkins tests. It will report a red or green mark depending on whether the build passes.
  • The "Add reviewer" button under Reviewers: in the upper left corner manually request review from someone. It'll show up in their Gerrit dashboard.
  • Reply adds your comments to a changeset, including an overall comment and/or inline comments you added (see above).
    • If, upon code review, you approve, use "Code-Review: +1" under "Reply"; otherwise, use "Code-Review: -1" to disapprove. These numbers are nonbinding, won't cause merges or rejections, and have no formal effect on the code review.
  • Abandon (you'll see this if you created this change). This action removes the change from the list to review, but leaves it in Gerrit for archival purposes.
  • The "Only Comments" switch allows to hide reviews by non-human bots. 例は phab:T48148#6294913 を参照してください。

Comparing patch sets

Every time you amend your commit and submit it for review, a new patch set is created. You can compare the different patch sets like this:

  • Under Files, select either Expand All or choose a specific file listed to open that file.
  • On the left side under Patch Set, Base is preselected.

On the right of the screen under Patch Set, the latest patch set is preselected. Adjust the selected patch sets to your needs.

Formally reviewing and merging or rejecting the change

If you are one of the Gerrit project owners, you'll also see:

  • Abandon button
  • under Reply, additional Code-Review options to +2 (approve) or -2 (veto) a diff, and a Post button (publish your comment and merge diff into the branch, in 1 step)
  • Submit button (merge -- only useful if you or someone else has already given a +2 approval to the diff, but not merged it)

And once you've merged something into the example Gerrit project you'll see it in https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/examples/.

If you merged a commit that references a task in Phabricator and that commit is supposed to fix that task completely, please go to that task and change its status to "Resolved" (via the Add Action… 🡒 Change Status dropdown). Also reference the merge ID if gerritbot has not already posted it in that task.