Merge branch 'stable-2.12'
* stable-2.12: AccountManager: Update display name only if it is not null. ChangeHookValidator: Fix old revision retrieval for root commit InlineEdit: Enable inline comments retrieval in change screen BanCommitCommand: Do not use commons.collections Change-Id: I777d6fcfbd1ee647322268ebc8c404a0723a3dfe
This commit is contained in:
commit
9fb3074eac
@ -329,6 +329,12 @@ public class ChangeInfo extends JavaScriptObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int findEditParent(JsArray<RevisionInfo> list) {
|
public static int findEditParent(JsArray<RevisionInfo> list) {
|
||||||
|
RevisionInfo r = findEditParentRevision(list);
|
||||||
|
return r == null ? -1 : r._number();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RevisionInfo findEditParentRevision(
|
||||||
|
JsArray<RevisionInfo> list) {
|
||||||
for (int i = 0; i < list.length(); i++) {
|
for (int i = 0; i < list.length(); i++) {
|
||||||
// edit under revisions?
|
// edit under revisions?
|
||||||
RevisionInfo editInfo = list.get(i);
|
RevisionInfo editInfo = list.get(i);
|
||||||
@ -340,12 +346,12 @@ public class ChangeInfo extends JavaScriptObject {
|
|||||||
String name = parentInfo.name();
|
String name = parentInfo.name();
|
||||||
if (name.equals(parentRevision)) {
|
if (name.equals(parentRevision)) {
|
||||||
// found parent pacth set number
|
// found parent pacth set number
|
||||||
return parentInfo._number();
|
return parentInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String id() {
|
public final String id() {
|
||||||
|
@ -881,7 +881,12 @@ public class ChangeScreen extends Screen {
|
|||||||
CallbackGroup group = new CallbackGroup();
|
CallbackGroup group = new CallbackGroup();
|
||||||
Timestamp lastReply = myLastReply(info);
|
Timestamp lastReply = myLastReply(info);
|
||||||
if (rev.isEdit()) {
|
if (rev.isEdit()) {
|
||||||
loadFileList(b, rev, lastReply, group, null, null);
|
// Comments are filtered for the current revision. Use parent
|
||||||
|
// patch set for edits, as edits themself can never have comments.
|
||||||
|
RevisionInfo p = RevisionInfo.findEditParentRevision(
|
||||||
|
info.revisions().values());
|
||||||
|
List<NativeMap<JsArray<CommentInfo>>> comments = loadComments(p, group);
|
||||||
|
loadFileList(b, rev, lastReply, group, comments, null);
|
||||||
} else {
|
} else {
|
||||||
loadDiff(b, rev, lastReply, group);
|
loadDiff(b, rev, lastReply, group);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.account;
|
package com.google.gerrit.server.account;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.google.gerrit.audit.AuditService;
|
import com.google.gerrit.audit.AuditService;
|
||||||
import com.google.gerrit.common.TimeUtil;
|
import com.google.gerrit.common.TimeUtil;
|
||||||
import com.google.gerrit.common.data.AccessSection;
|
import com.google.gerrit.common.data.AccessSection;
|
||||||
@ -175,7 +176,7 @@ public class AccountManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!realm.allowsEdit(Account.FieldName.FULL_NAME)
|
if (!realm.allowsEdit(Account.FieldName.FULL_NAME)
|
||||||
&& who.getDisplayName() != null
|
&& !Strings.isNullOrEmpty(who.getDisplayName())
|
||||||
&& !eq(user.getAccount().getFullName(), who.getDisplayName())) {
|
&& !eq(user.getAccount().getFullName(), who.getDisplayName())) {
|
||||||
toUpdate = load(toUpdate, user.getAccountId(), db);
|
toUpdate = load(toUpdate, user.getAccountId(), db);
|
||||||
toUpdate.setFullName(who.getDisplayName());
|
toUpdate.setFullName(who.getDisplayName());
|
||||||
|
@ -565,8 +565,10 @@ public class CommitValidators {
|
|||||||
IdentifiedUser user = refControl.getUser().asIdentifiedUser();
|
IdentifiedUser user = refControl.getUser().asIdentifiedUser();
|
||||||
|
|
||||||
String refname = receiveEvent.refName;
|
String refname = receiveEvent.refName;
|
||||||
ObjectId old = receiveEvent.commit.getParent(0);
|
ObjectId old = ObjectId.zeroId();
|
||||||
|
if (receiveEvent.commit.getParentCount() > 0) {
|
||||||
|
old = receiveEvent.commit.getParent(0);
|
||||||
|
}
|
||||||
if (receiveEvent.command.getRefName().startsWith(REFS_CHANGES)) {
|
if (receiveEvent.command.getRefName().startsWith(REFS_CHANGES)) {
|
||||||
/*
|
/*
|
||||||
* If the ref-update hook tries to distinguish behavior between pushes to
|
* If the ref-update hook tries to distinguish behavior between pushes to
|
||||||
|
@ -20,7 +20,6 @@ java_library(
|
|||||||
'//lib:jsch',
|
'//lib:jsch',
|
||||||
'//lib/auto:auto-value',
|
'//lib/auto:auto-value',
|
||||||
'//lib/commons:codec',
|
'//lib/commons:codec',
|
||||||
'//lib/commons:collections',
|
|
||||||
'//lib/dropwizard:dropwizard-core',
|
'//lib/dropwizard:dropwizard-core',
|
||||||
'//lib/guice:guice',
|
'//lib/guice:guice',
|
||||||
'//lib/guice:guice-assistedinject',
|
'//lib/guice:guice-assistedinject',
|
||||||
|
@ -28,7 +28,6 @@ import com.google.gerrit.sshd.CommandMetaData;
|
|||||||
import com.google.gerrit.sshd.SshCommand;
|
import com.google.gerrit.sshd.SshCommand;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
|
||||||
import org.eclipse.jgit.lib.ObjectId;
|
import org.eclipse.jgit.lib.ObjectId;
|
||||||
import org.kohsuke.args4j.Argument;
|
import org.kohsuke.args4j.Argument;
|
||||||
import org.kohsuke.args4j.Option;
|
import org.kohsuke.args4j.Option;
|
||||||
@ -77,7 +76,7 @@ public class BanCommitCommand extends SshCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void printCommits(List<String> commits, String message) {
|
private void printCommits(List<String> commits, String message) {
|
||||||
if (CollectionUtils.isNotEmpty(commits)) {
|
if (commits != null && !commits.isEmpty()) {
|
||||||
stdout.print(message + ":\n");
|
stdout.print(message + ":\n");
|
||||||
stdout.print(Joiner.on(",\n").join(commits));
|
stdout.print(Joiner.on(",\n").join(commits));
|
||||||
stdout.print("\n\n");
|
stdout.print("\n\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user