@Override public void run(ContinuationContext context) { final List<Change> changesForPatch; try { final List<CommittedChangeList> lst = loadSvnChangeListsForPatch(myDescription); changesForPatch = CommittedChangesTreeBrowser.collectChanges(lst, true); for (Change change : changesForPatch) { if (change.getBeforeRevision() != null) { preloadRevisionContents(change.getBeforeRevision()); } if (change.getAfterRevision() != null) { preloadRevisionContents(change.getAfterRevision()); } } } catch (VcsException e) { context.handleException(e, true); return; } final List<Change> binaryChanges = filterOutBinary(changesForPatch); if (binaryChanges != null && !binaryChanges.isEmpty()) { myTheirsBinaryChanges.addAll(binaryChanges); } if (!changesForPatch.isEmpty()) { myTheirsChanges.addAll(changesForPatch); } }
public List<ShelvedChangeList> importChangeLists( final Collection<VirtualFile> files, final Consumer<VcsException> exceptionConsumer) { final List<ShelvedChangeList> result = new ArrayList<ShelvedChangeList>(files.size()); try { final FilesProgress filesProgress = new FilesProgress(files.size(), "Processing "); for (VirtualFile file : files) { filesProgress.updateIndicator(file); final String description = file.getNameWithoutExtension().replace('_', ' '); final File patchPath = getPatchPath(description); final ShelvedChangeList list = new ShelvedChangeList( patchPath.getPath(), description, new SmartList<ShelvedBinaryFile>(), file.getTimeStamp()); try { final List<TextFilePatch> patchesList = loadPatches(myProject, file.getPath(), new CommitContext()); if (!patchesList.isEmpty()) { FileUtil.copy(new File(file.getPath()), patchPath); // add only if ok to read patch myShelvedChangeLists.add(list); result.add(list); } } catch (IOException e) { exceptionConsumer.consume(new VcsException(e)); } catch (PatchSyntaxException e) { exceptionConsumer.consume(new VcsException(e)); } } } finally { notifyStateChanged(); } return result; }
@Override public void run(ContinuationContext context) { if (myTheirsBinaryChanges.isEmpty()) return; final List<Change> converted; try { converted = convertPaths(myTheirsBinaryChanges); } catch (VcsException e) { context.handleException(e, true); return; } if (converted.isEmpty()) return; final Map<FilePath, Change> map = new HashMap<FilePath, Change>(); for (Change change : converted) { map.put(ChangesUtil.getFilePath(change), change); } final Collection<FilePath> selected = chooseBinaryFiles(converted, map.keySet()); myTheirsBinaryChanges.clear(); for (FilePath filePath : selected) { myTheirsBinaryChanges.add(map.get(filePath)); } }