private File getPatchPath(@NonNls final String commitMessage) { File file = myFileProcessor.getBaseIODir(); if (!file.exists()) { file.mkdirs(); } return suggestPatchName( myProject, commitMessage.length() > PatchNameChecker.MAX ? (commitMessage.substring(0, PatchNameChecker.MAX)) : commitMessage, file, VcsConfiguration.PATCH); }
private ShelvedBinaryFile shelveBinaryFile(final Change change) throws IOException { final ContentRevision beforeRevision = change.getBeforeRevision(); final ContentRevision afterRevision = change.getAfterRevision(); File beforeFile = beforeRevision == null ? null : beforeRevision.getFile().getIOFile(); File afterFile = afterRevision == null ? null : afterRevision.getFile().getIOFile(); String shelvedPath = null; if (afterFile != null) { String shelvedName = FileUtil.getNameWithoutExtension(afterFile.getName()); String shelvedExt = FileUtil.getExtension(afterFile.getName()); File shelvedFile = FileUtil.findSequentNonexistentFile( myFileProcessor.getBaseIODir(), shelvedName, shelvedExt); myFileProcessor.saveFile(afterRevision.getFile().getIOFile(), shelvedFile); shelvedPath = shelvedFile.getPath(); } String beforePath = ChangesUtil.getProjectRelativePath(myProject, beforeFile); String afterPath = ChangesUtil.getProjectRelativePath(myProject, afterFile); return new ShelvedBinaryFile(beforePath, afterPath, shelvedPath); }