ListTags: Include timestamp in tag info

The tags are listed in alphanumeric order, but some clients may wish
to order the tags by the date they were created.

Add a timestamp in the tag info.

For annotated/signed tags, the timestamp is the date at which the tag
was created.

For lightweight tags, the timestamp is set to the committer timestamp,
only when the tag is on a commit.

Change-Id: I34f49f19810fa430769a50b5ae43b8107527792b
This commit is contained in:
David Pursehouse
2017-11-10 10:17:46 +09:00
parent 638a829744
commit c4e4d93410
4 changed files with 60 additions and 6 deletions

View File

@@ -16,19 +16,47 @@ package com.google.gerrit.extensions.api.projects;
import com.google.gerrit.extensions.common.GitPerson;
import com.google.gerrit.extensions.common.WebLinkInfo;
import java.sql.Timestamp;
import java.util.List;
public class TagInfo extends RefInfo {
public String object;
public String message;
public GitPerson tagger;
public Timestamp created;
public List<WebLinkInfo> webLinks;
public TagInfo(String ref, String revision, Boolean canDelete, List<WebLinkInfo> webLinks) {
public TagInfo(
String ref,
String revision,
Boolean canDelete,
List<WebLinkInfo> webLinks,
Timestamp created) {
this.ref = ref;
this.revision = revision;
this.canDelete = canDelete;
this.webLinks = webLinks;
this.created = created;
}
public TagInfo(String ref, String revision, Boolean canDelete, List<WebLinkInfo> webLinks) {
this(ref, revision, canDelete, webLinks, null);
}
public TagInfo(
String ref,
String revision,
String object,
String message,
GitPerson tagger,
Boolean canDelete,
List<WebLinkInfo> webLinks,
Timestamp created) {
this(ref, revision, canDelete, webLinks, created);
this.object = object;
this.message = message;
this.tagger = tagger;
this.webLinks = webLinks;
}
public TagInfo(
@@ -39,7 +67,7 @@ public class TagInfo extends RefInfo {
GitPerson tagger,
Boolean canDelete,
List<WebLinkInfo> webLinks) {
this(ref, revision, canDelete, webLinks);
this(ref, revision, object, message, tagger, canDelete, webLinks, null);
this.object = object;
this.message = message;
this.tagger = tagger;