void (final @NotNull ShelvedChangeList listCopy, @NotNull List<ShelvedChange> shelvedChanges, @NotNull List<ShelvedBinaryFile> shelvedBinaryChanges, @NotNull CommitContext commitContext) { //listCopy should contain loaded changes removeBinaries(listCopy, shelvedBinaryChanges); removeChanges(listCopy, shelvedChanges); // create patch file based on filtered changes try { final List<FilePatch> patches = new ArrayList<>(); List<TextFilePatch> filePatches = loadPatches(myProject, listCopy.path, commitContext); for (ShelvedChange change : Objects.requireNonNull(listCopy.getChanges())) { patches.add(ContainerUtil.find(filePatches, patch -> change.getBeforePath().equals(patch.getBeforeName()))); } writePatchesToFile(myProject, listCopy.path, patches, commitContext); } catch (IOException | PatchSyntaxException e) { LOG.info(e); // left file as is } }