@Override
  public int editCommits(@NotNull File file) {
    GitRebaseEditingResult result;
    try {
      if (myRebaseEditorShown) {
        String encoding = GitConfigUtil.getCommitEncoding(myProject, myRoot);
        String originalMessage = FileUtil.loadFile(file, encoding);
        String newMessage = myRewordedCommitMessageProvider.getRewordedCommitMessage(myProject, myRoot, originalMessage);
        if (newMessage == null) {
          boolean unstructuredEditorCancelled = !handleUnstructuredEditor(file);
          result = unstructuredEditorCancelled ?
                   GitRebaseEditingResult.UnstructuredEditorCancelled.INSTANCE :
                   GitRebaseEditingResult.WasEdited.INSTANCE;
        }
        else {
          FileUtil.writeToFile(file, newMessage.getBytes(Charset.forName(encoding)));
          result = GitRebaseEditingResult.WasEdited.INSTANCE;
        }
      }
      else {
        setRebaseEditorShown();
        boolean success = handleInteractiveEditor(file);
        result = success ? GitRebaseEditingResult.WasEdited.INSTANCE : GitRebaseEditingResult.CommitListEditorCancelled.INSTANCE;
      }
    }
    catch (VcsException e) {
      LOG.warn("Failed to load commit details for commits from git rebase file: " + file, e);
      result = new GitRebaseEditingResult.Failed(e);
    }
    catch (Exception e) {
      LOG.error("Failed to edit git rebase file: " + file, e);
      result = new GitRebaseEditingResult.Failed(e);
    }
    myResult = result;
    return result.getExitCode();
  }
@Override
  public int editCommits(@NotNull File file)