mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
shelf: cleanup - get/load changes before unshelve
GitOrigin-RevId: d6dda5451e47dd291c2ee6caf6da0723ca847e2d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4d4d611de8
commit
acedee29f0
@@ -41,16 +41,17 @@ public class VcsShelveUtils {
|
||||
VirtualFile baseDir = project.getBaseDir();
|
||||
assert baseDir != null;
|
||||
final String projectPath = baseDir.getPath() + "/";
|
||||
final List<ShelvedChange> changes = shelvedChangeList.getChanges(project);
|
||||
List<ShelvedBinaryFile> binaryFiles = shelvedChangeList.getBinaryFiles();
|
||||
|
||||
LOG.info("refreshing files ");
|
||||
// The changes are temporary copied to the first local change list, the next operation will restore them back
|
||||
// Refresh files that might be affected by unshelve
|
||||
refreshFilesBeforeUnshelve(project, shelvedChangeList, projectPath);
|
||||
refreshFilesBeforeUnshelve(projectPath, changes, binaryFiles);
|
||||
|
||||
LOG.info("Unshelving shelvedChangeList: " + shelvedChangeList);
|
||||
final List<ShelvedChange> changes = shelvedChangeList.getChanges(project);
|
||||
// we pass null as target change list for Patch Applier to do NOTHING with change lists
|
||||
shelveManager.unshelveChangeList(shelvedChangeList, changes, shelvedChangeList.getBinaryFiles(), targetChangeList, false, true,
|
||||
shelveManager.unshelveChangeList(shelvedChangeList, changes, binaryFiles, targetChangeList, false, true,
|
||||
true, leftConflictTitle, rightConflictTitle, true);
|
||||
ApplicationManager.getApplication().invokeAndWait(() -> markUnshelvedFilesNonUndoable(project, changes));
|
||||
}
|
||||
@@ -72,24 +73,26 @@ public class VcsShelveUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void refreshFilesBeforeUnshelve(final Project project, ShelvedChangeList shelvedChangeList, String projectPath) {
|
||||
private static void refreshFilesBeforeUnshelve(String projectPath,
|
||||
@NotNull List<ShelvedChange> shelvedChanges,
|
||||
@NotNull List<ShelvedBinaryFile> binaryFiles) {
|
||||
HashSet<File> filesToRefresh = new HashSet<>();
|
||||
for (ShelvedChange c : shelvedChangeList.getChanges(project)) {
|
||||
shelvedChanges.forEach(c -> {
|
||||
if (c.getBeforePath() != null) {
|
||||
filesToRefresh.add(new File(projectPath + c.getBeforePath()));
|
||||
}
|
||||
if (c.getAfterPath() != null) {
|
||||
filesToRefresh.add(new File(projectPath + c.getAfterPath()));
|
||||
}
|
||||
}
|
||||
for (ShelvedBinaryFile f : shelvedChangeList.getBinaryFiles()) {
|
||||
});
|
||||
binaryFiles.forEach(f -> {
|
||||
if (f.BEFORE_PATH != null) {
|
||||
filesToRefresh.add(new File(projectPath + f.BEFORE_PATH));
|
||||
}
|
||||
if (f.AFTER_PATH != null) {
|
||||
filesToRefresh.add(new File(projectPath + f.AFTER_PATH));
|
||||
}
|
||||
}
|
||||
});
|
||||
LocalFileSystem.getInstance().refreshIoFiles(filesToRefresh);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user