Add support for tag web links

Change-Id: If431ad869e53d97e1f479edaf24e17f3b9ecbda2
This commit is contained in:
Paladox none
2017-07-01 14:49:10 +00:00
committed by David Pursehouse
parent e067dc8af9
commit 433e1a9102
12 changed files with 151 additions and 19 deletions

View File

@@ -28,6 +28,7 @@ import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.extensions.restapi.RestModifyView;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.WebLinks;
import com.google.gerrit.server.extensions.events.GitReferenceUpdated;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.TagCache;
@@ -60,6 +61,7 @@ public class CreateTag implements RestModifyView<ProjectResource, TagInput> {
private final GitRepositoryManager repoManager;
private final TagCache tagCache;
private final GitReferenceUpdated referenceUpdated;
private final WebLinks links;
private String ref;
@Inject
@@ -68,11 +70,13 @@ public class CreateTag implements RestModifyView<ProjectResource, TagInput> {
GitRepositoryManager repoManager,
TagCache tagCache,
GitReferenceUpdated referenceUpdated,
WebLinks webLinks,
@Assisted String ref) {
this.identifiedUser = identifiedUser;
this.repoManager = repoManager;
this.tagCache = tagCache;
this.referenceUpdated = referenceUpdated;
this.links = webLinks;
this.ref = ref;
}
@@ -134,7 +138,8 @@ public class CreateTag implements RestModifyView<ProjectResource, TagInput> {
result.getObjectId(),
identifiedUser.get().getAccount());
try (RevWalk w = new RevWalk(repo)) {
return ListTags.createTagInfo(result, w, refControl);
ProjectControl pctl = resource.getControl();
return ListTags.createTagInfo(result, w, refControl, pctl, links);
}
}
} catch (InvalidRevisionException e) {