)]}'
{
  "commit": "33534c4490dcde8dd352e1f1f799f4bcd52ab478",
  "tree": "5165ff126a7c28208db6fdc55cdd42d47fd92a99",
  "parents": [
    "e9545e14f54695fe50b92a7cedc82bc7515dd955"
  ],
  "author": {
    "name": "Edwin Kempin",
    "email": "ekempin@google.com",
    "time": "Thu Feb 18 12:32:50 2021 +0100"
  },
  "committer": {
    "name": "Edwin Kempin",
    "email": "ekempin@google.com",
    "time": "Tue Feb 23 14:28:03 2021 +0100"
  },
  "message": "Return current reviewers first in code owner suggestion\n\nThe frontend only suggests the best 5 code owners for a file. In the\nsuggestion dialog the frontend shows checkmarks for those files for\nwhich one of the suggested code owners has been added or selected as\nreviewer. If the change already has a reviewer that is a code owner of a\nfile, but this reviewer doesn\u0027t appear in suggested 5 code owners, the\nfrontend wrongly shows the file as not covered yet (no checkmark). To\nfix this we are now returning code owners that are reviewers first when\nsuggesting code owners. If the current reviewers are returned first,\nthey appear in the suggested code owners and hence the checkmarking\nlogic in the frontend will just work.\n\nTo return code owners that are reviewers first, we add a IS_REVIEWER\nscore next to the existing DISTANCE score. The IS_REVIEWER score is only\napplied if code owners are listed for a change (since otherwise there\nare no reviewers). The scoring for the IS_REVIEWER score can be 0.0\n(code owner is not a reviewer) and 1.0 (code owner is a reviewer). To\nensure that the IS_REVIEWER score takes precedence over the DISTANCE\nscore it has a higher weight. The IS_REVIEWER score has a weight of 2,\nwhile the DISTANCE score has a weight of 1. This means for code owners\nthat are reviewers the total score is \u003e\u003d 2.0 (2 * 1.0 + 1 * distance\nscoring, 0.0 \u003c\u003d distance scoring \u003c\u003d 1.0) while for code owners that are\nno reviewers the total score is \u003c\u003d 1.0 (2 * 0.0 + 1 * distance scoring,\n0.0 \u003c\u003d distance scoring \u003c\u003d 1.0).\n\nIn order for the sorting to work, we cannot abort the lookup of code\nowners once we found the best 5 code owners by distance score (or\nwhatever limit is provided), but we must always iterate over all\nrelevant OWNERS files. We already need to do this in most cases to find\nout if the file is owned by all users, so doing it always now shouldn\u0027t\nmake a big difference.\n\nHaving multiple scores with different weights was planned from the very\nbeginning, just so far we didn\u0027t have a need to implement weights as\nthere was only a single score.\n\nBug: Issue 14089\nChange-Id: Id2d9f0ebe08be7b613033bf03946190e8d0d849f\nSigned-off-by: Edwin Kempin \u003cekempin@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "065425d4d21780689d03cfff591bb5ab431a3fb5",
      "old_mode": 33188,
      "old_path": "java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScore.java",
      "new_id": "523c2ee94a672ea9bc70d5b51fa69ef4649a1d7f",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScore.java"
    },
    {
      "type": "modify",
      "old_id": "4694fd8942aa166e8301f9643340fbfd90d6215a",
      "old_mode": 33188,
      "old_path": "java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScoring.java",
      "new_id": "ce89e0791212e521b9ac0d92948fce79fa768baf",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScoring.java"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "84a263b3484145b77ad0e30d8fb1d0bfd4b6d99f",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScorings.java"
    },
    {
      "type": "modify",
      "old_id": "990ecb7e13c98b270278453308ed5f845d7667c0",
      "old_mode": 33188,
      "old_path": "java/com/google/gerrit/plugins/codeowners/restapi/AbstractGetCodeOwnersForPath.java",
      "new_id": "d406be17898664cb4f2c1de9e233afaf3deba8c7",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/restapi/AbstractGetCodeOwnersForPath.java"
    },
    {
      "type": "modify",
      "old_id": "5e188b81869508820cb5501564e372c77aa0ec91",
      "old_mode": 33188,
      "old_path": "java/com/google/gerrit/plugins/codeowners/restapi/GetCodeOwnersForPathInChange.java",
      "new_id": "f4755506f7a26c1c192ce2410294da5e70b73b8d",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/restapi/GetCodeOwnersForPathInChange.java"
    },
    {
      "type": "modify",
      "old_id": "c3e7ee1271f82a25da76acbf907e5f74990d606e",
      "old_mode": 33188,
      "old_path": "javatests/com/google/gerrit/plugins/codeowners/acceptance/api/GetCodeOwnersForPathInChangeIT.java",
      "new_id": "e0802a183005e6261933c37cfcfbd7ea120f06f8",
      "new_mode": 33188,
      "new_path": "javatests/com/google/gerrit/plugins/codeowners/acceptance/api/GetCodeOwnersForPathInChangeIT.java"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "f0072f0fb51f45bdfe22e0679a07f943af3c32d7",
      "new_mode": 33188,
      "new_path": "javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScoreTest.java"
    },
    {
      "type": "modify",
      "old_id": "0cab290cef2804b422aaa3916a01ce7ffb28f3b0",
      "old_mode": 33188,
      "old_path": "javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScoringTest.java",
      "new_id": "43498c651c797765394fec61b7fabe389d72c1e7",
      "new_mode": 33188,
      "new_path": "javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScoringTest.java"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "1bb70906a0ac975c56c213d1b5a3733e40c7d6bb",
      "new_mode": 33188,
      "new_path": "javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScoringsTest.java"
    },
    {
      "type": "modify",
      "old_id": "68d8f508bc5d5ba9db480f45839d6e64ef64a43d",
      "old_mode": 33188,
      "old_path": "resources/Documentation/rest-api.md",
      "new_id": "b977f3cba3f19e3b37dc2945c4c7e911295df07d",
      "new_mode": 33188,
      "new_path": "resources/Documentation/rest-api.md"
    }
  ]
}
