Search in sources :

Example 6 with BranchInfo

use of com.google.gerrit.extensions.api.projects.BranchInfo in project gerrit by GerritCodeReview.

the class ListBranchesIT method branch.

private static BranchInfo branch(String ref, String revision, boolean canDelete) {
    BranchInfo info = new BranchInfo();
    info.ref = ref;
    info.revision = revision;
    info.canDelete = canDelete ? true : null;
    return info;
}
Also used : BranchInfo(com.google.gerrit.extensions.api.projects.BranchInfo)

Example 7 with BranchInfo

use of com.google.gerrit.extensions.api.projects.BranchInfo in project gerrit by GerritCodeReview.

the class BranchesCollection method parse.

@Override
public BranchResource parse(ProjectResource parent, IdString id) throws ResourceNotFoundException, IOException, BadRequestException {
    String branchName = id.get();
    if (!branchName.equals(Constants.HEAD)) {
        branchName = RefNames.fullName(branchName);
    }
    List<BranchInfo> branches = list.get().apply(parent);
    for (BranchInfo b : branches) {
        if (branchName.equals(b.ref)) {
            return new BranchResource(parent.getControl(), b);
        }
    }
    throw new ResourceNotFoundException();
}
Also used : BranchInfo(com.google.gerrit.extensions.api.projects.BranchInfo) IdString(com.google.gerrit.extensions.restapi.IdString) ResourceNotFoundException(com.google.gerrit.extensions.restapi.ResourceNotFoundException)

Aggregations

BranchInfo (com.google.gerrit.extensions.api.projects.BranchInfo)7 BranchInput (com.google.gerrit.extensions.api.projects.BranchInput)3 ResourceNotFoundException (com.google.gerrit.extensions.restapi.ResourceNotFoundException)2 Repository (org.eclipse.jgit.lib.Repository)2 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)1 CherryPickInput (com.google.gerrit.extensions.api.changes.CherryPickInput)1 SubmitInput (com.google.gerrit.extensions.api.changes.SubmitInput)1 ActionInfo (com.google.gerrit.extensions.common.ActionInfo)1 ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)1 WebLinkInfo (com.google.gerrit.extensions.common.WebLinkInfo)1 AuthException (com.google.gerrit.extensions.restapi.AuthException)1 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)1 IdString (com.google.gerrit.extensions.restapi.IdString)1 ResourceConflictException (com.google.gerrit.extensions.restapi.ResourceConflictException)1 UiAction (com.google.gerrit.extensions.webui.UiAction)1 Branch (com.google.gerrit.reviewdb.client.Branch)1 PermissionBackend (com.google.gerrit.server.permissions.PermissionBackend)1 MagicBranch (com.google.gerrit.server.util.MagicBranch)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1