本文整理汇总了Java中com.intellij.openapi.vcs.changes.Change.isMoved方法的典型用法代码示例。如果您正苦于以下问题:Java Change.isMoved方法的具体用法?Java Change.isMoved怎么用?Java Change.isMoved使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vcs.changes.Change
的用法示例。
在下文中一共展示了Change.isMoved方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFirstCommitParentAndPathIfRename
import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
/**
* Gets info of the given commit and checks if it was a RENAME.
* If yes, returns the older file path, which file was renamed from.
* If it's not a rename, returns null.
*/
@Nullable
private static Pair<String, FilePath> getFirstCommitParentAndPathIfRename(Project project,
VirtualFile root,
String commit,
FilePath filePath,
@NotNull GitVersion version) throws VcsException {
// 'git show -M --name-status <commit hash>' returns the information about commit and detects renames.
// NB: we can't specify the filepath, because then rename detection will work only with the '--follow' option, which we don't wanna use.
final GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.SHOW);
final GitLogParser parser = new GitLogParser(project, GitLogParser.NameStatus.STATUS, HASH, COMMIT_TIME, PARENTS);
h.setStdoutSuppressed(true);
h.addParameters("-M", "--name-status", parser.getPretty(), "--encoding=UTF-8", commit);
if (!GitVersionSpecialty.FOLLOW_IS_BUGGY_IN_THE_LOG.existsIn(version)) {
h.addParameters("--follow");
h.endOptions();
h.addRelativePaths(filePath);
}
else {
h.endOptions();
}
final String output = h.run();
final List<GitLogRecord> records = parser.parse(output);
if (records.isEmpty()) return null;
// we have information about all changed files of the commit. Extracting information about the file we need.
GitLogRecord record = records.get(0);
final List<Change> changes = record.parseChanges(project, root);
for (Change change : changes) {
if ((change.isMoved() || change.isRenamed()) && filePath.equals(change.getAfterRevision().getFile())) {
final String[] parents = record.getParentsHashes();
String parent = parents.length > 0 ? parents[0] : null;
return Pair.create(parent, change.getBeforeRevision().getFile());
}
}
return null;
}
示例2: isMoveRenameReplace
import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
public static boolean isMoveRenameReplace(@NotNull Change c) {
if (c.getAfterRevision() == null || c.getBeforeRevision() == null) return false;
return c.isIsReplaced() ||
c.isMoved() ||
c.isRenamed() ||
(!Comparing.equal(c.getBeforeRevision().getFile(), c.getAfterRevision().getFile()));
}
示例3: getDistinctFiles
import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
private Collection<FilePath> getDistinctFiles(final Change change) {
final List<FilePath> result = new ArrayList<FilePath>(2);
if (change.getBeforeRevision() != null) {
result.add(change.getBeforeRevision().getFile());
}
if (change.getAfterRevision() != null) {
if (change.getBeforeRevision() == null || change.getBeforeRevision() != null && (change.isMoved() || change.isRenamed())) {
result.add(change.getAfterRevision().getFile());
}
}
return result;
}
示例4: getDiffWindowTitle
import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
@NotNull
private static String getDiffWindowTitle(@NotNull Change change) {
if (change.isMoved() || change.isRenamed()) {
final FilePath beforeFilePath = ChangesUtil.getBeforePath(change);
final FilePath afterFilePath = ChangesUtil.getAfterPath(change);
final String beforePath = beforeFilePath == null ? "" : beforeFilePath.getIOFile().getAbsolutePath();
final String afterPath = afterFilePath == null ? "" : afterFilePath.getIOFile().getAbsolutePath();
return SvnBundle.message("action.Subversion.properties.difference.diff.for.move.title", beforePath, afterPath);
} else {
return SvnBundle.message("action.Subversion.properties.difference.diff.title", ChangesUtil.getFilePath(change).getIOFile().getAbsolutePath());
}
}
示例5: movedOrRenamedOrReplaced
import com.intellij.openapi.vcs.changes.Change; //导入方法依赖的package包/类
public boolean movedOrRenamedOrReplaced(Change change) {
return change.isMoved() || change.isRenamed() || change.isIsReplaced();
}