Merge branch 'stable-3.0' into stable-3.1
* stable-3.0:
Upgrade bazlets to latest stable-3.0 to build with 3.0.11 API
Remove the commented-out snapshot plugin api lines
Change-Id: I2eea586fa55887d158e6874143ee7a01e54fe82c
diff --git a/WORKSPACE b/WORKSPACE
index 122b744..ade133b 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "7a9ae377b519934c87184cc05845663ed708b69c",
+ commit = "bd8db0cf3057397bcf7287c28cc93886e663989b",
#local_path = "/home/<user>/projects/bazlets",
)
diff --git a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/GetFullPathCommand.java b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/GetFullPathCommand.java
index ae16ef6..a4174d5 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/GetFullPathCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/GetFullPathCommand.java
@@ -17,9 +17,9 @@
import static com.google.gerrit.sshd.CommandMetaData.Mode.MASTER_OR_SLAVE;
import com.google.gerrit.common.data.GlobalCapability;
+import com.google.gerrit.entities.Project;
import com.google.gerrit.extensions.annotations.CapabilityScope;
import com.google.gerrit.extensions.annotations.RequiresCapability;
-import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.LocalDiskRepositoryManager;
import com.google.gerrit.sshd.CommandMetaData;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java
index 2c7062b..652ccb3 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java
@@ -16,10 +16,10 @@
import com.google.common.base.Strings;
import com.google.gerrit.common.data.GlobalCapability;
+import com.google.gerrit.entities.Account;
import com.google.gerrit.extensions.annotations.CapabilityScope;
import com.google.gerrit.extensions.annotations.RequiresCapability;
import com.google.gerrit.index.query.Predicate;
-import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.server.account.AccountState;
import com.google.gerrit.server.query.account.AccountPredicates;
import com.google.gerrit.server.query.account.InternalAccountQuery;
@@ -65,23 +65,20 @@
queryPredicate = Predicate.or(AccountPredicates.isActive(), AccountPredicates.isNotActive());
}
for (AccountState accountState : accountQueryProvider.get().query(queryPredicate)) {
- Account account = accountState.getAccount();
+ Account account = accountState.account();
String out =
new StringBuilder()
- .append(account.getId().toString())
+ .append(account.id().toString())
.append(" |")
.append(
- accountState.getUserName().isPresent()
+ accountState.userName().isPresent() ? "" : " " + accountState.userName().get())
+ .append(" |")
+ .append(Strings.isNullOrEmpty(account.fullName()) ? "" : " " + account.fullName())
+ .append(" |")
+ .append(
+ Strings.isNullOrEmpty(account.preferredEmail())
? ""
- : " " + accountState.getUserName().get())
- .append(" |")
- .append(
- Strings.isNullOrEmpty(account.getFullName()) ? "" : " " + account.getFullName())
- .append(" |")
- .append(
- Strings.isNullOrEmpty(account.getPreferredEmail())
- ? ""
- : " " + account.getPreferredEmail())
+ : " " + account.preferredEmail())
.append(" |")
.append(account.isActive() ? " active" : " inactive")
.toString();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java
index ffeaed4..3ebd8b0 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java
@@ -15,12 +15,12 @@
package com.googlesource.gerrit.plugins.adminconsole;
import com.google.gerrit.common.data.GlobalCapability;
+import com.google.gerrit.entities.Account;
import com.google.gerrit.extensions.annotations.CapabilityScope;
import com.google.gerrit.extensions.annotations.RequiresCapability;
import com.google.gerrit.extensions.common.GroupInfo;
import com.google.gerrit.extensions.common.SshKeyInfo;
import com.google.gerrit.extensions.restapi.AuthException;
-import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.AccountCache;
import com.google.gerrit.server.account.AccountResolver;
@@ -120,21 +120,21 @@
if (account == null) {
throw new UnloggedFailure("Account " + id.toString() + " does not exist.");
}
- stdout.println("Full name: " + account.getAccount().getFullName());
+ stdout.println("Full name: " + account.account().fullName());
stdout.println("Account Id: " + id.toString());
- stdout.println("Preferred Email: " + account.getAccount().getPreferredEmail());
+ stdout.println("Preferred Email: " + account.account().preferredEmail());
Optional<AccountState> accountState = accountCache.get(id);
if (accountState.isPresent()) {
- stdout.println("User Name: " + accountState.get().getUserName().get());
+ stdout.println("User Name: " + accountState.get().userName().get());
}
- stdout.println("Active: " + account.getAccount().isActive());
- stdout.println("Registered on: " + account.getAccount().getRegisteredOn());
+ stdout.println("Active: " + account.account().isActive());
+ stdout.println("Registered on: " + account.account().registeredOn());
stdout.println("");
stdout.println("External Ids:");
stdout.println(String.format("%-50s %s", "Email Address:", "External Id:"));
try {
- for (ExternalId externalId : externalIds.byAccount(account.getAccount().getId())) {
+ for (ExternalId externalId : externalIds.byAccount(account.account().id())) {
stdout.println(
String.format(
"%-50s %s",
@@ -148,7 +148,7 @@
stdout.println("Public Keys:");
List<SshKeyInfo> sshKeys;
try {
- sshKeys = getSshKeys.get().apply(new AccountResource(userFactory.create(id)));
+ sshKeys = getSshKeys.get().apply(new AccountResource(userFactory.create(id))).value();
} catch (AuthException
| IOException
| ConfigInvalidException
@@ -174,7 +174,7 @@
+ (filterGroups == null ? "" : " (Filtering on \"" + filterGroups + "\")")
+ ":");
List<GroupInfo> groupInfos =
- accountGetGroups.get().apply(new AccountResource(userFactory.create(id)));
+ accountGetGroups.get().apply(new AccountResource(userFactory.create(id))).value();
Collections.sort(groupInfos, new CustomComparator());
for (GroupInfo groupInfo : groupInfos) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccessCommand.java b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccessCommand.java
index 1a79ee7..6350b6b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccessCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccessCommand.java
@@ -18,9 +18,9 @@
import com.google.gerrit.common.data.GlobalCapability;
import com.google.gerrit.common.data.Permission;
import com.google.gerrit.common.data.PermissionRule;
+import com.google.gerrit.entities.Project;
import com.google.gerrit.extensions.annotations.CapabilityScope;
import com.google.gerrit.extensions.annotations.RequiresCapability;
-import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.git.meta.MetaDataUpdate;
import com.google.gerrit.server.project.ProjectConfig;
import com.google.gerrit.sshd.CommandMetaData;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java
index 6d0e4ca..383b0b9 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java
@@ -18,11 +18,11 @@
import com.google.gerrit.common.data.GlobalCapability;
import com.google.gerrit.common.data.Permission;
import com.google.gerrit.common.data.PermissionRule;
+import com.google.gerrit.entities.Account;
+import com.google.gerrit.entities.Project;
import com.google.gerrit.extensions.annotations.CapabilityScope;
import com.google.gerrit.extensions.annotations.RequiresCapability;
import com.google.gerrit.extensions.common.GroupInfo;
-import com.google.gerrit.reviewdb.client.Account;
-import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.AccountResolver;
import com.google.gerrit.server.account.AccountResource;
@@ -124,11 +124,11 @@
for (Account.Id id : idList) {
userHasPermissionsInProject = false;
account = accountResolver.resolve(id.toString()).asUnique();
- stdout.println("Full name: " + account.getAccount().getFullName());
+ stdout.println("Full name: " + account.account().fullName());
// Need to know what groups the user is in. This is not a great
// solution, but it does work.
List<GroupInfo> groupInfos =
- accountGetGroups.get().apply(new AccountResource(userFactory.create(id)));
+ accountGetGroups.get().apply(new AccountResource(userFactory.create(id))).value();
HashSet<String> groupHash = new HashSet<>();
for (GroupInfo groupInfo : groupInfos) {