protected static boolean canShowDiff(Change[] changes) { if (changes == null || changes.length == 0) return false; for (Change change : changes) { if (!ChangesUtil.getFilePath(change).isDirectory() || change.hasOtherLayers()) return true; } return false; }
@Nullable private static Change[] loadFakeRevisions(final Project project, final Change[] changes) { List<Change> matchingChanges = new ArrayList<Change>(); for (Change change : changes) { matchingChanges.addAll( ChangeListManager.getInstance(project).getChangesIn(ChangesUtil.getFilePath(change))); } return matchingChanges.toArray(new Change[matchingChanges.size()]); }
public static BeforeAfter<DiffContent> createBinaryDiffContents( final Project project, final Change change) throws VcsException { final FilePath filePath = ChangesUtil.getFilePath(change); try { return new BeforeAfter<DiffContent>( createBinaryFileContent(project, change.getBeforeRevision(), filePath.getName()), createBinaryFileContent(project, change.getAfterRevision(), filePath.getName())); } catch (IOException e) { throw new VcsException(e); } }
private static SimpleDiffRequest createBinaryDiffRequest( final Project project, final Change change) throws VcsException { final FilePath filePath = ChangesUtil.getFilePath(change); final SimpleDiffRequest request = new SimpleDiffRequest(project, filePath.getPath()); try { request.setContents( createBinaryFileContent(project, change.getBeforeRevision(), filePath.getName()), createBinaryFileContent(project, change.getAfterRevision(), filePath.getName())); return request; } catch (IOException e) { throw new VcsException(e); } }
private static boolean directoryOrBinary(final Change change) { // todo instead for repository tab, filter directories (? ask remotely ? non leaf nodes) /*if ((change.getBeforeRevision() instanceof BinaryContentRevision) || (change.getAfterRevision() instanceof BinaryContentRevision)) { changesList.remove(i); continue; }*/ final FilePath path = ChangesUtil.getFilePath(change); if (path.isDirectory()) { return !change.hasOtherLayers(); } /*final FileType type = path.getFileType(); if ((! FileTypes.UNKNOWN.equals(type)) && (type.isBinary())) { return true; }*/ return false; }
protected static boolean canShowDiff(Change[] changes) { if (changes == null || changes.length == 0) return false; return !ChangesUtil.getFilePath(changes[0]).isDirectory() || changes[0].hasOtherLayers(); }