shelf: optimize - do not load patch file for each change

GitOrigin-RevId: 85424b5e32e69cd2157dedc860aa7c88094f528c
This commit is contained in:
Nadya Zabrodina
2019-06-09 10:11:21 +03:00
committed by intellij-monorepo-bot
parent e6f8684bc4
commit 32bd852212
@@ -1166,8 +1166,9 @@ public class ShelveChangesManager implements PersistentStateComponent<Element>,
try {
final CommitContext commitContext = new CommitContext();
final List<FilePatch> patches = new ArrayList<>();
for (ShelvedChange change : listCopy.getChanges(myProject)) {
patches.add(change.loadFilePatch(myProject, commitContext));
List<TextFilePatch> filePatches = loadPatches(myProject, listCopy.PATH, commitContext);
for (ShelvedChange change : Objects.requireNonNull(listCopy.getChanges(myProject))) {
patches.add(find(filePatches, patch -> change.getBeforePath().equals(patch.getBeforeName())));
}
writePatchesToFile(myProject, listCopy.PATH, patches, commitContext);
}