Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
Upgrade bazlets to latest stable-2.15 to build with 2.15.12 API
Upgrade bazlets to latest stable-2.14 to build with 2.14.19 API
Change-Id: Ic864f44ef3ef806836a849515177d7ad8dd7d822
diff --git a/WORKSPACE b/WORKSPACE
index 2dd925b..0318adf 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "f4fcc606a6afa8ce27a013bcf62e495a5ec2505c",
+ commit = "86562a4c8c2e885aac89eafab34a90571be2ef09",
#local_path = "/home/<user>/projects/bazlets",
)
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 96b9c77..78ac5ab 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java
@@ -71,7 +71,9 @@
.append(account.getId().toString())
.append(" |")
.append(
- Strings.isNullOrEmpty(account.getUserName()) ? "" : " " + account.getUserName())
+ Strings.isNullOrEmpty(accountState.getUserName().get())
+ ? ""
+ : " " + accountState.getUserName().get())
.append(" |")
.append(
Strings.isNullOrEmpty(account.getFullName()) ? "" : " " + account.getFullName())
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 512828e..99c140e 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java
@@ -23,13 +23,15 @@
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Account.Id;
import com.google.gerrit.server.IdentifiedUser;
+import com.google.gerrit.server.account.AccountCache;
import com.google.gerrit.server.account.AccountResolver;
import com.google.gerrit.server.account.AccountResource;
-import com.google.gerrit.server.account.GetGroups;
-import com.google.gerrit.server.account.GetSshKeys;
+import com.google.gerrit.server.account.AccountState;
import com.google.gerrit.server.account.externalids.ExternalId;
import com.google.gerrit.server.account.externalids.ExternalIds;
import com.google.gerrit.server.permissions.PermissionBackendException;
+import com.google.gerrit.server.restapi.account.GetGroups;
+import com.google.gerrit.server.restapi.account.GetSshKeys;
import com.google.gerrit.sshd.CommandMetaData;
import com.google.gerrit.sshd.SshCommand;
import com.google.inject.Inject;
@@ -38,6 +40,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.kohsuke.args4j.Argument;
@@ -66,6 +69,7 @@
private final IdentifiedUser.GenericFactory userFactory;
private final Provider<GetSshKeys> getSshKeys;
private final ExternalIds externalIds;
+ private final AccountCache accountCache;
@Inject
ShowAccountCommand(
@@ -73,12 +77,14 @@
Provider<GetGroups> accountGetGroups,
IdentifiedUser.GenericFactory userFactory,
Provider<GetSshKeys> getSshKeys,
- ExternalIds externalIds) {
+ ExternalIds externalIds,
+ AccountCache accountCache) {
this.accountResolver = accountResolver;
this.accountGetGroups = accountGetGroups;
this.userFactory = userFactory;
this.getSshKeys = getSshKeys;
this.externalIds = externalIds;
+ this.accountCache = accountCache;
}
@Override
@@ -118,7 +124,10 @@
stdout.println("Full name: " + account.getFullName());
stdout.println("Account Id: " + id.toString());
stdout.println("Preferred Email: " + account.getPreferredEmail());
- stdout.println("User Name: " + account.getUserName());
+ Optional<AccountState> accountState = accountCache.get(id);
+ if (accountState.isPresent()) {
+ stdout.println("User Name: " + accountState.get().getUserName().get());
+ }
stdout.println("Active: " + account.isActive());
stdout.println("Registered on: " + account.getRegisteredOn());
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 130e69c..4c88634 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccessCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccessCommand.java
@@ -21,8 +21,8 @@
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.MetaDataUpdate;
-import com.google.gerrit.server.git.ProjectConfig;
+import com.google.gerrit.server.git.meta.MetaDataUpdate;
+import com.google.gerrit.server.project.ProjectConfig;
import com.google.gerrit.sshd.CommandMetaData;
import com.google.gerrit.sshd.SshCommand;
import com.google.inject.Inject;
@@ -83,7 +83,7 @@
stdout.print(
String.format(
permissionNameFormatter,
- (!rule.getMin().equals(rule.getMax()))
+ (rule.getMin() != rule.getMax())
? "" + rule.getMin() + " " + rule.getMax()
: rule.getAction(),
(permission.getExclusiveGroup() ? "EXCLUSIVE" : ""),
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 6b59bc1..2f542bf 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java
@@ -27,9 +27,9 @@
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.AccountResolver;
import com.google.gerrit.server.account.AccountResource;
-import com.google.gerrit.server.account.GetGroups;
-import com.google.gerrit.server.git.MetaDataUpdate;
-import com.google.gerrit.server.git.ProjectConfig;
+import com.google.gerrit.server.git.meta.MetaDataUpdate;
+import com.google.gerrit.server.project.ProjectConfig;
+import com.google.gerrit.server.restapi.account.GetGroups;
import com.google.gerrit.sshd.CommandMetaData;
import com.google.gerrit.sshd.SshCommand;
import com.google.inject.Inject;
@@ -150,7 +150,7 @@
sb.append(
String.format(
permissionNameFormatter,
- (!rule.getMin().equals(rule.getMax()))
+ (rule.getMin() != rule.getMax())
? "" + rule.getMin() + " " + rule.getMax()
: rule.getAction(),
(permission.getExclusiveGroup() ? "EXCLUSIVE" : ""),