从 gerrit url 获取提交日期

Get commit date from gerrit url

我有 gerrit url,我想获取提交日期。 Gerrit 查询不会为您提供提交日期。它只给出 createOn 和 lastupdatedOn。如果我在 gerrit 更改上添加注释,lastUpdatedOn 值会更改,所以我不愿意使用它。有没有办法获取提交日期,因为它显示在 gerrit 上?提前致谢。

由于每个更改都可能包含多个提交,因此您必须指定要使用 Revision Endpoint's Get Commit API:

查询的修订
 GET /changes/{change-id}/revisions/{revision-id}/commit

进一步引用文档:

Request

GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/674ac754f91e64a0efb8087e59a176484bd534d1/commit HTTP/1.0

As response a CommitInfo entity is returned that describes the revision.

Response

  HTTP/1.1 200 OK
  Content-Disposition: attachment
  Content-Type: application/json; charset=UTF-8

  )]}'
  {
    "commit": "674ac754f91e64a0efb8087e59a176484bd534d1",
    "parents": [
      {
        "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
        "subject": "Migrate contributor agreements to All-Projects."
      }
    ],
    "author": {
      "name": "Shawn O. Pearce",
      "email": "sop@google.com",
      "date": "2012-04-24 18:08:08.000000000",
      "tz": -420
    },
    "committer": {
      "name": "Shawn O. Pearce",
      "email": "sop@google.com",
      "date": "2012-04-24 18:08:08.000000000",
      "tz": -420
    },
    "subject": "Use an EventBus to manage star icons",
    "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..."
  }

Adding query parameter links (for example /changes/…​/commit?links) returns a CommitInfo with the additional field web_links.