Merge "Merge branch 'stable-2.12'"
This commit is contained in:
		@@ -1976,7 +1976,7 @@ using the property 'gitweb.pathSeparator'.
 | 
			
		||||
+
 | 
			
		||||
Valid values are the characters '*', '(' and ')'.
 | 
			
		||||
 | 
			
		||||
[[gitweb.linkDrafts]]gitweb.urlEncode::
 | 
			
		||||
[[gitweb.urlEncode]]gitweb.urlEncode::
 | 
			
		||||
+
 | 
			
		||||
Whether or not Gerrit should encode the generated viewer URL.
 | 
			
		||||
+
 | 
			
		||||
 
 | 
			
		||||
@@ -102,8 +102,7 @@ public class ActionsIT extends AbstractDaemonTest {
 | 
			
		||||
      assertThat(info.enabled).isNull();
 | 
			
		||||
      assertThat(info.label).isEqualTo("Submit whole topic");
 | 
			
		||||
      assertThat(info.method).isEqualTo("POST");
 | 
			
		||||
      assertThat(info.title).isEqualTo(
 | 
			
		||||
          "See the \"Submitted Together\" tab for problems, specially see: 2");
 | 
			
		||||
      assertThat(info.title).isEqualTo("Problems with change(s): 2");
 | 
			
		||||
    } else {
 | 
			
		||||
      noSubmitWholeTopicAssertions(actions, 1);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,7 @@ public class SafeHtmlBuilderTest {
 | 
			
		||||
    final SafeHtmlBuilder b = new SafeHtmlBuilder();
 | 
			
		||||
    assertThat(b).isSameAs(b.append('a'));
 | 
			
		||||
    assertThat(b).isSameAs(b.append('b'));
 | 
			
		||||
    assertThat("ab");
 | 
			
		||||
    assertThat(b.asString()).isEqualTo("ab");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Test
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,8 @@
 | 
			
		||||
 | 
			
		||||
package com.google.gerrit.client.admin;
 | 
			
		||||
 | 
			
		||||
import com.google.gerrit.client.ErrorDialog;
 | 
			
		||||
import com.google.gerrit.client.Gerrit;
 | 
			
		||||
import com.google.gerrit.client.groups.GroupMap;
 | 
			
		||||
import com.google.gerrit.client.rpc.GerritCallback;
 | 
			
		||||
import com.google.gerrit.common.data.AccessSection;
 | 
			
		||||
@@ -219,7 +221,7 @@ public class PermissionEditor extends Composite implements Editor<Permission>,
 | 
			
		||||
    addStage2.getStyle().setDisplay(Display.NONE);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private void addGroup(GroupReference ref) {
 | 
			
		||||
  private void addGroup(final GroupReference ref) {
 | 
			
		||||
    if (ref.getUUID() != null) {
 | 
			
		||||
      if (value.getRule(ref) == null) {
 | 
			
		||||
        PermissionRule newRule = value.getRule(ref, true);
 | 
			
		||||
@@ -253,6 +255,8 @@ public class PermissionEditor extends Composite implements Editor<Permission>,
 | 
			
		||||
                    result.values().get(0).name()));
 | 
			
		||||
              } else {
 | 
			
		||||
                groupToAdd.setFocus(true);
 | 
			
		||||
                new ErrorDialog(Gerrit.M.noSuchGroupMessage(ref.getName()))
 | 
			
		||||
                    .center();
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -281,9 +281,9 @@ class GitwebServlet extends HttpServlet {
 | 
			
		||||
      p.print("  my $h = shift;\n");
 | 
			
		||||
      p.print("  my $q;\n");
 | 
			
		||||
      p.print("  if (!$h || $h eq 'HEAD') {\n");
 | 
			
		||||
      p.print("    $q = qq{#q,project:$ENV{'GERRIT_PROJECT_NAME'}};\n");
 | 
			
		||||
      p.print("    $q = qq{#/q/project:$ENV{'GERRIT_PROJECT_NAME'}};\n");
 | 
			
		||||
      p.print("  } elsif ($h =~ /^refs\\/heads\\/([-\\w]+)$/) {\n");
 | 
			
		||||
      p.print("    $q = qq{#q,project:$ENV{'GERRIT_PROJECT_NAME'}");
 | 
			
		||||
      p.print("    $q = qq{#/q/project:$ENV{'GERRIT_PROJECT_NAME'}");
 | 
			
		||||
      p.print("+branch:$1};\n"); // wrapped
 | 
			
		||||
      p.print("  } elsif ($h =~ /^refs\\/changes\\/\\d{2}\\/(\\d+)\\/\\d+$/) ");
 | 
			
		||||
      p.print("{\n"); // wrapped
 | 
			
		||||
 
 | 
			
		||||
@@ -100,8 +100,10 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
 | 
			
		||||
      "This change depends on other hidden changes which are not ready";
 | 
			
		||||
  private static final String CLICK_FAILURE_TOOLTIP =
 | 
			
		||||
      "Clicking the button would fail";
 | 
			
		||||
  private static final String CHANGE_UNMERGEABLE =
 | 
			
		||||
      "Problems with integrating this change";
 | 
			
		||||
  private static final String CHANGES_NOT_MERGEABLE =
 | 
			
		||||
      "See the \"Submitted Together\" tab for problems, specially see: ";
 | 
			
		||||
      "Problems with change(s): ";
 | 
			
		||||
 | 
			
		||||
  public static class Output {
 | 
			
		||||
    transient Change change;
 | 
			
		||||
@@ -246,11 +248,12 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @param cd the change the user is currently looking at
 | 
			
		||||
   * @param cs set of changes to be submitted at once
 | 
			
		||||
   * @param user the user who is checking to submit
 | 
			
		||||
   * @return a reason why any of the changes is not submittable or null
 | 
			
		||||
   */
 | 
			
		||||
  private String problemsForSubmittingChangeset(ChangeSet cs,
 | 
			
		||||
  private String problemsForSubmittingChangeset(ChangeData cd, ChangeSet cs,
 | 
			
		||||
      CurrentUser user) {
 | 
			
		||||
    try {
 | 
			
		||||
      @SuppressWarnings("resource")
 | 
			
		||||
@@ -271,6 +274,11 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
 | 
			
		||||
      if (unmergeable == null) {
 | 
			
		||||
        return CLICK_FAILURE_TOOLTIP;
 | 
			
		||||
      } else if (!unmergeable.isEmpty()) {
 | 
			
		||||
        for (ChangeData c : unmergeable) {
 | 
			
		||||
          if (c.change().getKey().equals(cd.change().getKey())) {
 | 
			
		||||
            return CHANGE_UNMERGEABLE;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        return CHANGES_NOT_MERGEABLE + Joiner.on(", ").join(
 | 
			
		||||
            Iterables.transform(unmergeable,
 | 
			
		||||
                new Function<ChangeData, String>() {
 | 
			
		||||
@@ -332,13 +340,6 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
 | 
			
		||||
        .setVisible(false);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Boolean enabled;
 | 
			
		||||
    try {
 | 
			
		||||
      enabled = cd.isMergeable();
 | 
			
		||||
    } catch (OrmException e) {
 | 
			
		||||
      throw new OrmRuntimeException("Could not determine mergeability", e);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ChangeSet cs;
 | 
			
		||||
    try {
 | 
			
		||||
      cs = mergeSuperSet.completeChangeSet(
 | 
			
		||||
@@ -357,7 +358,23 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
 | 
			
		||||
        && topicSize > 1;
 | 
			
		||||
 | 
			
		||||
    String submitProblems =
 | 
			
		||||
        problemsForSubmittingChangeset(cs, resource.getUser());
 | 
			
		||||
        problemsForSubmittingChangeset(cd, cs, resource.getUser());
 | 
			
		||||
 | 
			
		||||
    Boolean enabled;
 | 
			
		||||
    try {
 | 
			
		||||
      // Recheck mergeability rather than using value stored in the index,
 | 
			
		||||
      // which may be stale.
 | 
			
		||||
      // TODO(dborowitz): This is ugly; consider providing a way to not read
 | 
			
		||||
      // stored fields from the index in the first place.
 | 
			
		||||
      // cd.setMergeable(null);
 | 
			
		||||
      // That was done in unmergeableChanges which was called by
 | 
			
		||||
      // problemsForSubmittingChangeset, so now it is safe to read from
 | 
			
		||||
      // the cache, as it yields the same result.
 | 
			
		||||
      enabled = cd.isMergeable();
 | 
			
		||||
    } catch (OrmException e) {
 | 
			
		||||
      throw new OrmRuntimeException("Could not determine mergeability", e);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (submitProblems != null) {
 | 
			
		||||
      return new UiAction.Description()
 | 
			
		||||
        .setLabel(treatWithTopic
 | 
			
		||||
 
 | 
			
		||||
@@ -20,6 +20,7 @@ import com.google.gerrit.extensions.restapi.IdString;
 | 
			
		||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
 | 
			
		||||
import com.google.gerrit.extensions.restapi.RestView;
 | 
			
		||||
import com.google.inject.Inject;
 | 
			
		||||
import com.google.inject.Provider;
 | 
			
		||||
import com.google.inject.Singleton;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
@@ -28,24 +29,24 @@ import java.io.IOException;
 | 
			
		||||
public class TagsCollection implements
 | 
			
		||||
    ChildCollection<ProjectResource, TagResource> {
 | 
			
		||||
  private final DynamicMap<RestView<TagResource>> views;
 | 
			
		||||
  private final ListTags list;
 | 
			
		||||
  private final Provider<ListTags> list;
 | 
			
		||||
 | 
			
		||||
  @Inject
 | 
			
		||||
  public TagsCollection(DynamicMap<RestView<TagResource>> views,
 | 
			
		||||
     ListTags list) {
 | 
			
		||||
     Provider<ListTags> list) {
 | 
			
		||||
    this.views = views;
 | 
			
		||||
    this.list = list;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  public RestView<ProjectResource> list() throws ResourceNotFoundException {
 | 
			
		||||
    return list;
 | 
			
		||||
    return list.get();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  public TagResource parse(ProjectResource resource, IdString id)
 | 
			
		||||
      throws ResourceNotFoundException, IOException {
 | 
			
		||||
    return new TagResource(resource.getControl(), list.get(resource, id));
 | 
			
		||||
    return new TagResource(resource.getControl(), list.get().get(resource, id));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
 
 | 
			
		||||
@@ -997,11 +997,11 @@ public void setPatchSets(Collection<PatchSet> patchSets) {
 | 
			
		||||
        return Collections.emptySet();
 | 
			
		||||
      }
 | 
			
		||||
      editsByUser = new HashSet<>();
 | 
			
		||||
      Change.Id id = change.getId();
 | 
			
		||||
      Change.Id id = checkNotNull(change.getId());
 | 
			
		||||
      try (Repository repo = repoManager.openRepository(project())) {
 | 
			
		||||
        for (String ref
 | 
			
		||||
            : repo.getRefDatabase().getRefs(RefNames.REFS_USERS).keySet()) {
 | 
			
		||||
          if (Change.Id.fromEditRefPart(ref).equals(id)) {
 | 
			
		||||
          if (id.equals(Change.Id.fromEditRefPart(ref))) {
 | 
			
		||||
            editsByUser.add(Account.Id.fromRefPart(ref));
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user