From 33c520e7b0d42c6780c9099ffd48e18105f53e1e Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 17 May 2017 12:26:03 +0300 Subject: [PATCH] vcs: @Deprecate `createFilePathOnDeleted` method * it is not different from createFilePath --- .../src/com/intellij/openapi/vcs/VcsVFSListener.java | 2 +- .../com/intellij/openapi/vcs/actions/VcsContextFactory.java | 4 +++- platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java | 6 +++++- .../src/com/intellij/peer/impl/VcsContextFactoryImpl.java | 1 - .../actions/RemoveLocallyFileOrDirectoryAction.java | 2 +- plugins/git4idea/src/git4idea/GitContentRevision.java | 2 +- .../src/git4idea/checkin/GitCheckinEnvironment.java | 2 +- plugins/git4idea/src/git4idea/history/GitLogRecord.java | 2 +- .../src/org/jetbrains/idea/svn/SvnChangeProvider.java | 2 +- .../src/org/jetbrains/idea/svn/history/SvnChangeList.java | 2 +- 10 files changed, 15 insertions(+), 10 deletions(-) diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.java index 5ea047adf1c1..e85a1992acff 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.java @@ -183,7 +183,7 @@ public abstract class VcsVFSListener implements Disposable { else { final VcsDeleteType type = needConfirmDeletion(file); final FilePath filePath = - VcsContextFactory.SERVICE.getInstance().createFilePathOnDeleted(new File(file.getPath()), file.isDirectory()); + VcsContextFactory.SERVICE.getInstance().createFilePathOn(new File(file.getPath()), file.isDirectory()); if (type == VcsDeleteType.CONFIRM) { myDeletedFiles.add(filePath); } diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/actions/VcsContextFactory.java b/platform/vcs-api/src/com/intellij/openapi/vcs/actions/VcsContextFactory.java index 2f6bbe23f172..a1577313d35f 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/actions/VcsContextFactory.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/actions/VcsContextFactory.java @@ -21,7 +21,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.changes.LocalChangeList; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.NotNullFunction; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -59,8 +58,11 @@ public interface VcsContextFactory { * @param file the file for which the FilePath should be created. * @param isDirectory whether {@code file} specifies a file or a directory. * @return the FilePath instance. + * + * @deprecated use {@link #createFilePathOn(File, boolean)} */ @NotNull + @Deprecated FilePath createFilePathOnDeleted(@NotNull File file, boolean isDirectory); /** diff --git a/platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java b/platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java index 141be92fddb5..9087f7a81058 100644 --- a/platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java +++ b/platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java @@ -298,8 +298,12 @@ public class VcsUtil { return VcsContextFactory.SERVICE.getInstance().createFilePathOn(file, isDirectory); } + /** + * @deprecated use {@link #getFilePath(String, boolean)} + */ + @Deprecated public static FilePath getFilePathForDeletedFile(@NotNull String path, boolean isDirectory) { - return VcsContextFactory.SERVICE.getInstance().createFilePathOnDeleted(new File(path), isDirectory); + return VcsContextFactory.SERVICE.getInstance().createFilePathOn(new File(path), isDirectory); } @NotNull diff --git a/platform/vcs-impl/src/com/intellij/peer/impl/VcsContextFactoryImpl.java b/platform/vcs-impl/src/com/intellij/peer/impl/VcsContextFactoryImpl.java index 468d28502397..e912599cc258 100644 --- a/platform/vcs-impl/src/com/intellij/peer/impl/VcsContextFactoryImpl.java +++ b/platform/vcs-impl/src/com/intellij/peer/impl/VcsContextFactoryImpl.java @@ -27,7 +27,6 @@ import com.intellij.openapi.vcs.changes.LocalChangeList; import com.intellij.openapi.vcs.changes.LocalChangeListImpl; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.NotNullFunction; import org.jetbrains.annotations.NotNull; import java.io.File; diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/RemoveLocallyFileOrDirectoryAction.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/RemoveLocallyFileOrDirectoryAction.java index 2c3c4a8fa71c..e7503909212a 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/RemoveLocallyFileOrDirectoryAction.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/actions/RemoveLocallyFileOrDirectoryAction.java @@ -99,7 +99,7 @@ public class RemoveLocallyFileOrDirectoryAction extends ActionOnSelectedElement private static List filesToFilePaths(final ArrayList files) { final List result = new ArrayList<>(); for(File f: files) { - result.add(VcsContextFactory.SERVICE.getInstance().createFilePathOnDeleted(f, false)); + result.add(VcsContextFactory.SERVICE.getInstance().createFilePathOn(f, false)); } return result; } diff --git a/plugins/git4idea/src/git4idea/GitContentRevision.java b/plugins/git4idea/src/git4idea/GitContentRevision.java index 8ab1fbf6cb9d..739decb21fc1 100644 --- a/plugins/git4idea/src/git4idea/GitContentRevision.java +++ b/plugins/git4idea/src/git4idea/GitContentRevision.java @@ -164,7 +164,7 @@ public class GitContentRevision implements ByteBackedContentRevision { boolean canBeDeleted, boolean unescapePath) throws VcsException { String absolutePath = makeAbsolutePath(vcsRoot, path, unescapePath); - FilePath file = isDeleted ? VcsUtil.getFilePathForDeletedFile(absolutePath, false) : VcsUtil.getFilePath(absolutePath, false); + FilePath file = VcsUtil.getFilePath(absolutePath, false); if (canBeDeleted && (! SystemInfo.isFileSystemCaseSensitive) && VcsFilePathUtil.caseDiffers(file.getPath(), absolutePath)) { // as for deleted file file = VcsUtil.getFilePath(absolutePath, false); diff --git a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java index 2133cd9fe888..ba330caec23d 100644 --- a/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java +++ b/plugins/git4idea/src/git4idea/checkin/GitCheckinEnvironment.java @@ -413,7 +413,7 @@ public class GitCheckinEnvironment implements CheckinEnvironment { realAdded.add(VcsUtil.getFilePath(rootPath + "/" + tk[1])); break; case 'D': - realRemoved.add(VcsUtil.getFilePathForDeletedFile(rootPath + "/" + tk[1], false)); + realRemoved.add(VcsUtil.getFilePath(rootPath + "/" + tk[1], false)); break; default: throw new IllegalStateException("Unexpected status: " + line); diff --git a/plugins/git4idea/src/git4idea/history/GitLogRecord.java b/plugins/git4idea/src/git4idea/history/GitLogRecord.java index 8d313856c556..1f3b6917bc1c 100644 --- a/plugins/git4idea/src/git4idea/history/GitLogRecord.java +++ b/plugins/git4idea/src/git4idea/history/GitLogRecord.java @@ -78,7 +78,7 @@ class GitLogRecord { String prefix = root.getPath() + "/"; for (String strPath : getPaths()) { final String subPath = GitUtil.unescapePath(strPath); - final FilePath revisionPath = VcsUtil.getFilePathForDeletedFile(prefix + subPath, false); + final FilePath revisionPath = VcsUtil.getFilePath(prefix + subPath, false); res.add(revisionPath); } return res; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java index d9e0bd0a1317..cb45732bda05 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnChangeProvider.java @@ -248,7 +248,7 @@ public class SvnChangeProvider implements ChangeProvider { status = null; } if (status != null && status.is(StatusType.STATUS_DELETED)) { - final FilePath filePath = myFactory.createFilePathOnDeleted(wcPath, false); + final FilePath filePath = myFactory.createFilePathOn(wcPath, false); final SvnContentRevision beforeRevision = SvnContentRevision.createBaseRevision(myVcs, filePath, status.getRevision()); final ContentRevision afterRevision = CurrentContentRevision.create(copiedFile.getFilePath()); context.getBuilder().processChangeInList(context.createMovedChange(beforeRevision, afterRevision, copiedStatus, status), diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java index 1ae19c384362..c8dccf97291f 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnChangeList.java @@ -333,7 +333,7 @@ public class SvnChangeList implements CommittedChangeList, VcsRevisionNumberAwar final SvnFileUrlMapping urlMapping = myVcs.getSvnFileUrlMapping(); final File file = urlMapping.getLocalPath(fullPath); if (file != null) { - return VcsUtil.getFilePathForDeletedFile(file.getAbsolutePath(), isDir || file.isDirectory()); + return VcsUtil.getFilePath(file.getAbsolutePath(), isDir || file.isDirectory()); } return null;