Merge branch 'stable-2.11' into stable-2.12
* stable-2.11: 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: Iddb4b9ea60428a271457c082b77afb787606dc24
This commit is contained in:
		@@ -329,6 +329,12 @@ public class ChangeInfo extends JavaScriptObject {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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++) {
 | 
			
		||||
        // edit under revisions?
 | 
			
		||||
        RevisionInfo editInfo = list.get(i);
 | 
			
		||||
@@ -340,12 +346,12 @@ public class ChangeInfo extends JavaScriptObject {
 | 
			
		||||
            String name = parentInfo.name();
 | 
			
		||||
            if (name.equals(parentRevision)) {
 | 
			
		||||
              // found parent pacth set number
 | 
			
		||||
              return parentInfo._number();
 | 
			
		||||
              return parentInfo;
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      return -1;
 | 
			
		||||
      return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public final String id() {
 | 
			
		||||
 
 | 
			
		||||
@@ -881,7 +881,12 @@ public class ChangeScreen extends Screen {
 | 
			
		||||
    CallbackGroup group = new CallbackGroup();
 | 
			
		||||
    Timestamp lastReply = myLastReply(info);
 | 
			
		||||
    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 {
 | 
			
		||||
      loadDiff(b, rev, lastReply, group);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,7 @@
 | 
			
		||||
 | 
			
		||||
package com.google.gerrit.server.account;
 | 
			
		||||
 | 
			
		||||
import com.google.common.base.Strings;
 | 
			
		||||
import com.google.gerrit.audit.AuditService;
 | 
			
		||||
import com.google.gerrit.common.TimeUtil;
 | 
			
		||||
import com.google.gerrit.common.data.AccessSection;
 | 
			
		||||
@@ -175,7 +176,7 @@ public class AccountManager {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!realm.allowsEdit(Account.FieldName.FULL_NAME)
 | 
			
		||||
        && who.getDisplayName() != null
 | 
			
		||||
        && !Strings.isNullOrEmpty(who.getDisplayName())
 | 
			
		||||
        && !eq(user.getAccount().getFullName(), who.getDisplayName())) {
 | 
			
		||||
      toUpdate = load(toUpdate, user.getAccountId(), db);
 | 
			
		||||
      toUpdate.setFullName(who.getDisplayName());
 | 
			
		||||
 
 | 
			
		||||
@@ -564,8 +564,10 @@ public class CommitValidators {
 | 
			
		||||
        IdentifiedUser user = refControl.getUser().asIdentifiedUser();
 | 
			
		||||
 | 
			
		||||
        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 the ref-update hook tries to distinguish behavior between pushes to
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,6 @@ java_library(
 | 
			
		||||
    '//lib:jsch',
 | 
			
		||||
    '//lib/auto:auto-value',
 | 
			
		||||
    '//lib/commons:codec',
 | 
			
		||||
    '//lib/commons:collections',
 | 
			
		||||
    '//lib/guice:guice',
 | 
			
		||||
    '//lib/guice:guice-assistedinject',
 | 
			
		||||
    '//lib/guice:guice-servlet',  # SSH should not depend on servlet
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,6 @@ import com.google.gerrit.sshd.CommandMetaData;
 | 
			
		||||
import com.google.gerrit.sshd.SshCommand;
 | 
			
		||||
import com.google.inject.Inject;
 | 
			
		||||
 | 
			
		||||
import org.apache.commons.collections.CollectionUtils;
 | 
			
		||||
import org.eclipse.jgit.lib.ObjectId;
 | 
			
		||||
import org.kohsuke.args4j.Argument;
 | 
			
		||||
import org.kohsuke.args4j.Option;
 | 
			
		||||
@@ -77,7 +76,7 @@ public class BanCommitCommand extends SshCommand {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private void printCommits(List<String> commits, String message) {
 | 
			
		||||
    if (CollectionUtils.isNotEmpty(commits)) {
 | 
			
		||||
    if (commits != null && !commits.isEmpty()) {
 | 
			
		||||
      stdout.print(message + ":\n");
 | 
			
		||||
      stdout.print(Joiner.on(",\n").join(commits));
 | 
			
		||||
      stdout.print("\n\n");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user