User:TCipriani (WMF)/Gerrit/Changes

From mediawiki.org

🧑🏽‍💻 Gerrit for Product Analytics


Uploading changes

You need to change a patch you've sent to Gerrit (your patchset)

# 1️⃣ Step 1: Fetch your patch

Navigate to your local copy of the repository (see the tutorial if you don't have a local copy).

Next, download the patch you want to work on from Gerrit.

  1. Navigate to your local copy of the repo
  2. Get your local copy even with the mainline branch, or make a fresh copy
  3. Go to gerrit url (example)
  4. Click the three vertical dots on the upper-right, then click: Download Patch
  5. Copy the command for Cherry Pick
  6. Paste the command in your terminal

three dots Gerrit download patch – Cherry pick

Git Cherry Pick
$ git fetch https://gerrit.wikimedia.org/r/schemas/event/secondary refs/changes/87/735387/1 && git cherry-pick FETCH_HEAD
From https://gerrit.wikimedia.org/r/schemas/event/secondary
 * branch            refs/changes/87/735387/1 -> FETCH_HEAD
[master 9250b4b] Add mediawiki/desktop/button/click
 Date: Thu Oct 28 07:17:36 2021 -0600
 7 files changed, 132 insertions(+)
 create mode 120000 jsonschema/mediawiki/desktop/button/click/1.0.0
 create mode 100644 jsonschema/mediawiki/desktop/button/click/1.0.0.json
 create mode 100644 jsonschema/mediawiki/desktop/button/click/1.0.0.yaml
 create mode 100644 jsonschema/mediawiki/desktop/button/click/current.yaml
 create mode 120000 jsonschema/mediawiki/desktop/button/click/latest
 create mode 120000 jsonschema/mediawiki/desktop/button/click/latest.json
 create mode 120000 jsonschema/mediawiki/desktop/button/click/latest.yaml

# 2️⃣ Step 2: Make changes

Make the changes to your files and save.

# 3️⃣ Step 3: Commit your changes

Below I run three commands:

  • git add
  • git commit --amend --no-edit
‼️ it's important to use git commit --amend. If you miss --amend you will make two commits and two patchsets
Make changes
$ $EDITOR jsonschema/mediawiki/desktop/button/click/current.yaml
secondary (master * u+1) 40s
$ git add jsonschema/mediawiki/desktop/button/click/current.yaml
secondary (master + u+1)
$ git commit --amend --no-edit
[2021-10-28 15:49:00.476 +0000]: Looking for modified current.yaml schema files in ./jsonschema/
[2021-10-28 15:49:00.535 +0000]: Materializing /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/current.yaml...
[2021-10-28 15:49:00.541 +0000]: Dereferencing schema with $id /mediawiki/desktop/button/click/1.1.0 using schema base URIs ./jsonschema/,https://schema.wikimedia.org/repositories/primary/jsonschema/
[2021-10-28 15:49:00.567 +0000]: Materialized schema at /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/1.1.0.json.
[2021-10-28 15:49:00.569 +0000]: Materialized schema at /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/1.1.0.yaml.
[2021-10-28 15:49:00.571 +0000]: Created latest symlink /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/latest.json -> 1.1.0.json.
[2021-10-28 15:49:00.572 +0000]: Created latest symlink /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/latest.yaml -> 1.1.0.yaml.
[2021-10-28 15:49:00.572 +0000]: Created extensionless symlink /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/1.1.0 -> 1.1.0.yaml.
[2021-10-28 15:49:00.574 +0000]: Created latest symlink /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/latest -> 1.1.0.yaml.
[2021-10-28 15:49:00.575 +0000]: New schema files have been materialized. Adding them to git: /home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/1.1.0.yaml,/home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/latest.yaml,/home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/1.1.0,/home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/latest,/home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/1.1.0.json,/home/thcipriani/Projects/gerrit-for-product-analytics/schemas/event/secondary/jsonschema/mediawiki/desktop/button/click/latest.json
[master 0a7bf1f] Add mediawiki/desktop/button/click
 Date: Thu Oct 28 07:17:36 2021 -0600
 10 files changed, 224 insertions(+)
 create mode 120000 jsonschema/mediawiki/desktop/button/click/1.0.0
 create mode 100644 jsonschema/mediawiki/desktop/button/click/1.0.0.json
 create mode 100644 jsonschema/mediawiki/desktop/button/click/1.0.0.yaml
 create mode 120000 jsonschema/mediawiki/desktop/button/click/1.1.0
 create mode 100644 jsonschema/mediawiki/desktop/button/click/1.1.0.json
 create mode 100644 jsonschema/mediawiki/desktop/button/click/1.1.0.yaml
 create mode 100644 jsonschema/mediawiki/desktop/button/click/current.yaml
 create mode 120000 jsonschema/mediawiki/desktop/button/click/latest
 create mode 120000 jsonschema/mediawiki/desktop/button/click/latest.json
 create mode 120000 jsonschema/mediawiki/desktop/button/click/latest.yaml

# 4️⃣ Step 4: Push your changes back to gerrit

git review -R