private static List<TextFilePatch> loadTextPatches(@NotNull Project project,
                                                     ShelvedChangeList changeList,
                                                     List<ShelvedChange> changes,
                                                     List<? super FilePatch> remainingPatches,
                                                     CommitContext commitContext)
    throws IOException, PatchSyntaxException {
    List<TextFilePatch> textFilePatches = loadPatches(project, changeList.getPath(), commitContext);

    if (changes != null) {
      textFilePatches = ContainerUtil.filter(textFilePatches, patch -> {
        if (needUnshelve(patch, changes)) {
          return true;
        }
        else {
          remainingPatches.add(patch);
          return false;
        }
      });
    }
    return textFilePatches;
  }
private static List<TextFilePatch> loadTextPatches(@NotNull Project project,
                                                     ShelvedChangeList changeList,
                                                     List<ShelvedChange> changes,
                                                     List<? super FilePatch> remainingPatches,
                                                     CommitContext commitContext)