ListChildProjects: Use parent predicate to find child projects

Change-Id: I4c51f0c3826a71ad4aec9246e07883741b95b7ff
This commit is contained in:
David Ostrovsky
2019-01-30 00:07:17 +01:00
committed by David Pursehouse
parent f358a748bb
commit ddd38f36dc
3 changed files with 25 additions and 39 deletions

View File

@@ -33,6 +33,7 @@ import com.google.gerrit.server.restapi.project.ListChildProjects;
import com.google.gerrit.server.restapi.project.SetParent;
import com.google.gerrit.sshd.CommandMetaData;
import com.google.gerrit.sshd.SshCommand;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import java.io.IOException;
import java.util.ArrayList;
@@ -111,7 +112,7 @@ final class SetParentCommand extends SshCommand {
childProjects.addAll(getChildrenForReparenting(oldParent));
} catch (PermissionBackendException e) {
throw new Failure(1, "permissions unavailable", e);
} catch (RestApiException e) {
} catch (OrmException | RestApiException e) {
throw new Failure(1, "failure in request", e);
}
}
@@ -148,7 +149,7 @@ final class SetParentCommand extends SshCommand {
* reparenting.
*/
private List<Project.NameKey> getChildrenForReparenting(ProjectState parent)
throws PermissionBackendException, RestApiException {
throws PermissionBackendException, OrmException, RestApiException {
final List<Project.NameKey> childProjects = new ArrayList<>();
final List<Project.NameKey> excluded = new ArrayList<>(excludedChildren.size());
for (ProjectState excludedChild : excludedChildren) {