<commit_before>// Copyright 2009 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
package org.emergent.bzr4j.intellij.provider.commit;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.CheckinProjectPanel;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ChangeList;
import com.intellij.openapi.vcs.changes.ContentRevision;
import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
import com.intellij.openapi.vcs.ui.RefreshableOnComponent;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.NullableFunction;
import com.intellij.util.PairConsumer;
import com.intellij.vcsUtil.VcsUtil;
import org.emergent.bzr4j.intellij.BzrFile;
import org.emergent.bzr4j.intellij.BzrVcsMessages;
import org.emergent.bzr4j.intellij.command.BzrAddCommand;
import org.emergent.bzr4j.intellij.command.BzrCommandException;
import org.emergent.bzr4j.intellij.command.BzrCommitCommand;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class BzrCheckinEnvironment implements CheckinEnvironment {

  private final Project project;

  public BzrCheckinEnvironment(Project project) {
    this.project = project;
  }

  public RefreshableOnComponent createAdditionalOptionsPanel(CheckinProjectPanel panel) {
    return createAdditionalOptionsPanel(panel, null);
  }

  public RefreshableOnComponent createAdditionalOptionsPanel(
      CheckinProjectPanel checkinProjectPanel,
      PairConsumer<Object, Object> objectObjectPairConsumer) {
    return null;
  }

  public String getDefaultMessageFor(FilePath[] filesToCheckin) {
    return null;
  }

  public String getHelpId() {
    return null;
  }

  public String getCheckinOperationName() {
    Object[] params = new Object[] { };
    return BzrVcsMessages.message("bzr4intellij.commit", params);
  }

  public List<VcsException> commit(List<Change> changes, String preparedComment) {
    //noinspection unchecked
    return commit(changes, preparedComment, NullableFunction.NULL);
  }

  @SuppressWarnings({ "ThrowableInstanceNeverThrown" })
  public List<VcsException> commit(List<Change> changes, String preparedComment, @NotNull NullableFunction<Object, Object> parametersHolder) {
    List<VcsException> exceptions = new LinkedList<VcsException>();
    for (Map.Entry<VirtualFile, List<BzrFile>> entry : getFilesByRepository(changes).entrySet()) {
      BzrCommitCommand command = new BzrCommitCommand(project, entry.getKey(), preparedComment);
      command.setFiles(entry.getValue());
      try {
        command.execute();
      } catch (BzrCommandException e) {<commit_msg>Add Set<String> feedback argument to BzrCheckinEnvironment.commit so that it compiles against IntelliJ IDEA 11.0<commit_after>// Copyright 2009 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
package org.emergent.bzr4j.intellij.provider.commit;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.CheckinProjectPanel;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ChangeList;
import com.intellij.openapi.vcs.changes.ContentRevision;
import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
import com.intellij.openapi.vcs.ui.RefreshableOnComponent;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.NullableFunction;
import com.intellij.util.PairConsumer;
import com.intellij.vcsUtil.VcsUtil;
import org.emergent.bzr4j.intellij.BzrFile;
import org.emergent.bzr4j.intellij.BzrVcsMessages;
import org.emergent.bzr4j.intellij.command.BzrAddCommand;
import org.emergent.bzr4j.intellij.command.BzrCommandException;
import org.emergent.bzr4j.intellij.command.BzrCommitCommand;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class BzrCheckinEnvironment implements CheckinEnvironment {

  private final Project project;

  public BzrCheckinEnvironment(Project project) {
    this.project = project;
  }

  public RefreshableOnComponent createAdditionalOptionsPanel(CheckinProjectPanel panel) {
    return createAdditionalOptionsPanel(panel, null);
  }

  public RefreshableOnComponent createAdditionalOptionsPanel(
      CheckinProjectPanel checkinProjectPanel,
      PairConsumer<Object, Object> objectObjectPairConsumer) {
    return null;
  }

  public String getDefaultMessageFor(FilePath[] filesToCheckin) {
    return null;
  }

  public String getHelpId() {
    return null;
  }

  public String getCheckinOperationName() {
    Object[] params = new Object[] { };
    return BzrVcsMessages.message("bzr4intellij.commit", params);
  }

  public List<VcsException> commit(List<Change> changes, String preparedComment) {
    //noinspection unchecked
    return commit(changes, preparedComment, NullableFunction.NULL);
  }

  @SuppressWarnings({ "ThrowableInstanceNeverThrown" })
  public List<VcsException> commit(
      List<Change> changes,
      String preparedComment,
      @NotNull NullableFunction<Object, Object> parametersHolder,
      Set<String> feedback) {
    List<VcsException> exceptions = new LinkedList<VcsException>();
    for (Map.Entry<VirtualFile, List<BzrFile>> entry : getFilesByRepository(changes).entrySet()) {
      BzrCommitCommand command = new BzrCommitCommand(project, entry.getKey(), preparedComment);
      command.setFiles(entry.getValue());
      try {
        command.execute();
      } catch (BzrCommandException e) {
{'fraction_non_alphanumeric': 0.0944168371821105, 'fraction_numerical': 0.00482315112540193, 'mean_word_length': 5.007901668129938, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '23248', 'n_tokens_mistral': 2107, 'n_tokens_neox': 2026, 'n_words': 476}