Merge branch 'stable-2.14' into stable-2.15

* stable-2.14:
  AccountManager: Reduce logs to debug level
  AccountManager: Use Logger's built-in string formatting
  Documentation: clarify what happens if you override a label in a child.
  Prolog cookbook: fix several examples.

Change-Id: Ib78d6d45829c125e574a03177d51dbebe9d5d462
This commit is contained in:
David Pursehouse 2018-04-24 20:55:24 +09:00
commit 4e34c1c036
3 changed files with 13 additions and 8 deletions

View File

@ -161,7 +161,9 @@ properties in the child project's configuration; all properties from
the parent definition must be redefined in the child.
To remove a label in a child project, add an empty label with the same
name as in the parent.
name as in the parent. This will override the parent label with
a label containing the defaults (`function = MaxWithBlock`,
`defaultValue = 0` and no further allowed values)
[[label_layout]]
=== Layout

View File

@ -544,6 +544,7 @@ submit_rule(submit(Author)) :-
Author = label('Author-is-John-Doe', need(_)).
submit_rule(submit(Author)) :-
A = user(1000000),
gerrit:commit_author(A, 'John Doe', 'john.doe@example.com'),
Author = label('Author-is-John-Doe', ok(A)).
----
@ -899,7 +900,10 @@ add_category_min_score(In, Category, Min, P) :-
findall(X, gerrit:commit_label(label(Category,X),R),Z),
sum_list(Z, Sum),
Sum >= Min, !,
P = [label(Category,ok(R)) | In].
gerrit:commit_label(label(Category, V), U),
V >= 1,
!,
P = [label(Category,ok(U)) | In].
add_category_min_score(In, Category,Min,P) :-
P = [label(Category,need(Min)) | In].

View File

@ -154,7 +154,7 @@ public class AccountManager {
}
// New account, automatically create and return.
//
log.info("External ID not found. Attempting to create new account.");
log.debug("External ID not found. Attempting to create new account.");
return create(db, who);
}
@ -244,9 +244,7 @@ public class AccountManager {
if (!realm.allowsEdit(AccountFieldName.USER_NAME)
&& who.getUserName() != null
&& !eq(user.getUserName(), who.getUserName())) {
log.warn(
String.format(
"Not changing already set username %s to %s", user.getUserName(), who.getUserName()));
log.warn("Not changing already set username {} to {}", user.getUserName(), who.getUserName());
}
if (!accountUpdates.isEmpty()) {
@ -404,15 +402,16 @@ public class AccountManager {
public AuthResult link(Account.Id to, AuthRequest who)
throws AccountException, OrmException, IOException, ConfigInvalidException {
ExternalId extId = externalIds.get(who.getExternalIdKey());
log.info("Link another authentication identity to an existing account");
log.debug("Link another authentication identity to an existing account");
if (extId != null) {
if (!extId.accountId().equals(to)) {
throw new AccountException(
"Identity '" + extId.key().get() + "' in use by another account");
}
log.debug("Updating existing external ID data");
update(who, extId);
} else {
log.info("Linking new external ID to the existing account");
log.debug("Linking new external ID to the existing account");
externalIdsUpdateFactory
.create()
.insert(ExternalId.createWithEmail(who.getExternalIdKey(), to, who.getEmailAddress()));