ShelveDiffRequestProducer (@NotNull Project project, @NotNull String base, @NotNull ApplyPatchContext patchContext, @NotNull ShelvedChange shelvedChange, boolean withLocal) { final String beforePath = shelvedChange.getBeforePath(); final String afterPath = shelvedChange.getAfterPath(); final FilePath filePath = VcsUtil.getFilePath(new File(base, afterPath), false); try { if (FileStatus.ADDED.equals(shelvedChange.getFileStatus())) { return new NewFileTextShelveDiffRequestProducer(project, shelvedChange, filePath, withLocal); } else { VirtualFile file = ApplyFilePatchBase.findPatchTarget(patchContext, beforePath, afterPath); if (file == null || !file.exists()) throw new FileNotFoundException(beforePath); return new TextShelveDiffRequestProducer(project, shelvedChange, filePath, file, patchContext, withLocal); } } catch (IOException e) { return new PatchShelveDiffRequestProducer(project, shelvedChange, filePath); } }