本文整理汇总了Java中com.intellij.openapi.vcs.FilePath类的典型用法代码示例。如果您正苦于以下问题:Java FilePath类的具体用法?Java FilePath怎么用?Java FilePath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FilePath类属于com.intellij.openapi.vcs包,在下文中一共展示了FilePath类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: clearChanges
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
private void clearChanges(Collection<Change> changes) {
for (Change change : changes) {
ContentRevision revision = change.getAfterRevision();
if (revision != null) {
FilePath filePath = revision.getFile();
String path = filePath.getPath();
final Conflict wasRemoved = myConflicts.remove(path);
final VirtualFile file = filePath.getVirtualFile();
if (wasRemoved != null && file != null) {
myEditorNotifications.updateNotifications(file);
// we need to update status
myFileStatusManager.fileStatusChanged(file);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ChangelistConflictTracker.java
示例2: processFiles
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
protected List<VcsException> processFiles(final AbstractVcs vcs, final List<FilePath> files) {
RollbackEnvironment environment = vcs.getRollbackEnvironment();
if (environment == null) return Collections.emptyList();
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null) {
indicator.setText(vcs.getDisplayName() + ": performing rollback...");
}
final List<VcsException> result = new ArrayList<VcsException>(0);
try {
environment.rollbackMissingFileDeletion(files, result, new RollbackProgressModifier(files.size(), indicator));
}
catch (ProcessCanceledException e) {
// for files refresh
}
LocalFileSystem.getInstance().refreshIoFiles(ChangesUtil.filePathsToFiles(files));
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:RollbackDeletionAction.java
示例3: showDiff
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
/**
* Invokes {@link com.intellij.openapi.diff.DiffManager#getDiffTool()} to show difference between the given revisions of the given file.
* @param project project under vcs control.
* @param path file which revisions are compared.
* @param revision1 first revision - 'before', to the left.
* @param revision2 second revision - 'after', to the right.
* @throws VcsException
* @throws IOException
*/
public static void showDiff(@NotNull final Project project, @NotNull FilePath path,
@NotNull VcsFileRevision revision1, @NotNull VcsFileRevision revision2,
@NotNull String title1, @NotNull String title2) throws VcsException, IOException {
final byte[] content1 = loadRevisionContent(revision1);
final byte[] content2 = loadRevisionContent(revision2);
String title = DiffRequestFactoryImpl.getContentTitle(path);
DiffContent diffContent1 = createContent(project, content1, revision1, path);
DiffContent diffContent2 = createContent(project, content2, revision2, path);
final DiffRequest request = new SimpleDiffRequest(title, diffContent1, diffContent2, title1, title2);
request.putUserData(REVISIONS_KEY, new VcsFileRevision[]{revision1, revision2});
WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() {
public void run() {
DiffManager.getInstance().showDiff(project, request);
}
}, null, project);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:VcsHistoryUtil.java
示例4: whatFilesDirty
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
@NotNull
@Override
public Collection<FilePath> whatFilesDirty(@NotNull final Collection<FilePath> files) {
DirtBuilder dirtBuilder;
DirtBuilder dirtBuilderInProgress;
synchronized (LOCK) {
if (!myReady) return Collections.emptyList();
dirtBuilder = new DirtBuilder(myDirtBuilder);
dirtBuilderInProgress = myDirtInProgress != null ? new DirtBuilder(myDirtInProgress) : new DirtBuilder(myGuess);
}
VcsInvalidated invalidated = calculateInvalidated(dirtBuilder);
VcsInvalidated inProgress = calculateInvalidated(dirtBuilderInProgress);
Collection<FilePath> result = ContainerUtil.newArrayList();
for (FilePath fp : files) {
if (invalidated.isFileDirty(fp) || inProgress.isFileDirty(fp)) {
result.add(fp);
}
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:VcsDirtyScopeManagerImpl.java
示例5: process
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
public void process(@NotNull FilePath path, final Status status) {
VirtualFile file = path.getVirtualFile();
if (file != null) {
if (status.is(StatusType.STATUS_EXTERNAL)) {
// We do not determine here url, repository url - because url, repository url in status will determine location in the
// repository where folder is located and not where svn:externals property points. We want the later parameters - they'll
// determined while creating RootUrlInfos later. Format will be also determined later.
// TODO: Probably we could move that logic here.
myCopies.add(new NestedCopyInfo(file, null, WorkingCopyFormat.UNKNOWN, NestedCopyType.external, null));
}
else if (status.getURL() != null && !status.is(StatusType.STATUS_UNVERSIONED) && status.isSwitched()) {
// this one called when there is switched directory under nested working copy
// TODO: some other cases?
myCopies.add(new NestedCopyInfo(file, status.getURL(), myVcs.getWorkingCopyFormat(path.getIOFile()), NestedCopyType.switched,
status.getRepositoryRootURL()));
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:NestedCopiesBuilder.java
示例6: createFileContent
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
@NotNull
@Override
public ContentRevision createFileContent(@NotNull VcsRevisionNumber revisionNumber, @NotNull VirtualFile selectedFile) {
FilePath filePath = VcsUtil.getFilePath(selectedFile);
SVNRevision svnRevision = ((SvnRevisionNumber)revisionNumber).getRevision();
if (!SVNRevision.HEAD.equals(svnRevision) && revisionNumber.equals(getCurrentRevision(selectedFile))) {
return SvnContentRevision.createBaseRevision(myVcs, filePath, svnRevision);
}
// not clear why we need it, with remote check..
Status svnStatus = getFileStatus(VfsUtilCore.virtualToIoFile(selectedFile), false);
return svnStatus != null && svnRevision.equals(svnStatus.getRevision())
? SvnContentRevision.createBaseRevision(myVcs, filePath, svnRevision)
: SvnContentRevision.createRemote(myVcs, filePath, svnRevision);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SvnDiffProvider.java
示例7: sortFilePathsByGitRoot
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
/**
* Sort files by vcs root
*
* @param files files to sort.
* @param ignoreNonGit if true, non-git files are ignored
* @return the map from root to the files under the root
* @throws VcsException if non git files are passed when {@code ignoreNonGit} is false
*/
@NotNull
public static Map<VirtualFile, List<FilePath>> sortFilePathsByGitRoot(@NotNull Collection<FilePath> files, boolean ignoreNonGit)
throws VcsException {
Map<VirtualFile, List<FilePath>> rc = new HashMap<VirtualFile, List<FilePath>>();
for (FilePath p : files) {
VirtualFile root = getGitRootOrNull(p);
if (root == null) {
if (ignoreNonGit) {
continue;
}
else {
throw new VcsException("The file " + p.getPath() + " is not under Git");
}
}
List<FilePath> l = rc.get(root);
if (l == null) {
l = new ArrayList<FilePath>();
rc.put(root, l);
}
l.add(p);
}
return rc;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:GitUtil.java
示例8: getFilesOverwrittenByMerge
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
private List<FilePath> getFilesOverwrittenByMerge(@NotNull List<String> mergeOutput) {
final List<FilePath> paths = new ArrayList<FilePath>();
for (String line : mergeOutput) {
if (StringUtil.isEmptyOrSpaces(line)) {
continue;
}
if (line.contains("Please, commit your changes or stash them before you can merge")) {
break;
}
line = line.trim();
final String path;
try {
path = myRoot.getPath() + "/" + GitUtil.unescapePath(line);
final File file = new File(path);
if (file.exists()) {
paths.add(VcsUtil.getFilePath(file, false));
}
} catch (VcsException e) { // just continue
}
}
return paths;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GitMergeUpdater.java
示例9: processBinaryFiles
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
private static void processBinaryFiles(@NotNull final Project project,
@NotNull List<ShelvedBinaryFile> files,
@NotNull List<MyDiffRequestProducer> diffRequestProducers) {
final String base = project.getBaseDir().getPath();
for (final ShelvedBinaryFile shelvedChange : files) {
diffRequestProducers.add(new MyDiffRequestProducer(shelvedChange) {
@NotNull
@Override
public DiffRequest process(@NotNull UserDataHolder context, @NotNull ProgressIndicator indicator)
throws DiffRequestProducerException, ProcessCanceledException {
Change change = shelvedChange.createChange(project);
return PatchDiffRequestFactory.createDiffRequest(project, change, getName(), context, indicator);
}
@NotNull
@Override
public FilePath getFilePath() {
final File file = new File(base, shelvedChange.AFTER_PATH == null ? shelvedChange.BEFORE_PATH : shelvedChange.AFTER_PATH);
return VcsUtil.getFilePath(file);
}
});
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DiffShelvedChangesAction.java
示例10: getPaths
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
private Paths getPaths(final TreeConflictDescription description) {
FilePath mainPath;
FilePath additionalPath = null;
if (myChange.isMoved() || myChange.isRenamed()) {
if (ConflictAction.ADD.equals(description.getConflictAction())) {
mainPath = myChange.getAfterRevision().getFile();
additionalPath = myChange.getBeforeRevision().getFile();
} else {
mainPath = myChange.getBeforeRevision().getFile();
additionalPath = myChange.getAfterRevision().getFile();
}
} else {
mainPath = myChange.getBeforeRevision() != null ? myChange.getBeforeRevision().getFile() : myChange.getAfterRevision().getFile();
}
return new Paths(mainPath, additionalPath);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TreeConflictRefreshablePanel.java
示例11: onlyHashesHistory
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
public static List<Pair<SHAHash, Date>> onlyHashesHistory(Project project, FilePath path, final VirtualFile root, final String... parameters)
throws VcsException {
// adjust path using change manager
path = getLastCommitName(project, path);
GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.LOG);
GitLogParser parser = new GitLogParser(project, HASH, COMMIT_TIME);
h.setStdoutSuppressed(true);
h.addParameters(parameters);
h.addParameters(parser.getPretty(), "--encoding=UTF-8");
h.endOptions();
h.addRelativePaths(path);
String output = h.run();
final List<Pair<SHAHash, Date>> rc = new ArrayList<Pair<SHAHash, Date>>();
for (GitLogRecord record : parser.parse(output)) {
record.setUsedHandler(h);
rc.add(Pair.create(new SHAHash(record.getHash()), record.getDate()));
}
return rc;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GitHistoryUtils.java
示例12: buildFilePaths
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
private void buildFilePaths(final Collection<FilePath> filePaths, final ChangesBrowserNode baseNode) {
final ChangesGroupingPolicy policy = createGroupingPolicy();
for (FilePath file : filePaths) {
assert file != null;
// whether a folder does not matter
final String path = file.getPath();
final StaticFilePath pathKey = ! FileUtil.isAbsolute(path) || VcsUtil.isPathRemote(path) ?
new StaticFilePath(false, path, null) :
new StaticFilePath(false, new File(file.getIOFile().getPath().replace('\\', '/')).getAbsolutePath(), file.getVirtualFile());
ChangesBrowserNode oldNode = myFoldersCache.get(pathKey.getKey());
if (oldNode == null) {
final ChangesBrowserNode node = ChangesBrowserNode.create(myProject, file);
final ChangesBrowserNode parentNode = getParentNodeFor(pathKey, policy, baseNode);
model.insertNodeInto(node, parentNode, 0);
// we could also ask whether a file or directory, though for deleted files not a good idea
myFoldersCache.put(pathKey.getKey(), node);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:TreeModelBuilder.java
示例13: getHistory
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
private static List<HgFileRevision> getHistory(FilePath filePath, VirtualFile vcsRoot, Project project) {
VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(project);
int limit = vcsConfiguration.LIMIT_HISTORY ? vcsConfiguration.MAXIMUM_HISTORY_ROWS : -1;
final HgLogCommand logCommand = new HgLogCommand(project);
logCommand
.setFollowCopies(!filePath.isDirectory());
logCommand.setIncludeRemoved(true);
try {
return logCommand.execute(new HgFile(vcsRoot, filePath), limit, false);
}
catch (HgCommandException e) {
new HgCommandResultNotifier(project).notifyError(null, HgVcsMessages.message("hg4idea.error.log.command.execution"), e.getMessage());
return Collections.emptyList();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:HgHistoryProvider.java
示例14: commit
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
public List<VcsException> commit(List<Change> changes,
final String preparedComment,
@NotNull NullableFunction<Object, Object> parametersHolder,
final Set<String> feedback) {
final List<VcsException> exception = new ArrayList<VcsException>();
final List<FilePath> committables = getCommitables(changes);
final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
if (progress != null) {
doCommit(committables, preparedComment, exception, feedback);
}
else if (ApplicationManager.getApplication().isDispatchThread()) {
ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
public void run() {
doCommit(committables, preparedComment, exception, feedback);
}
}, SvnBundle.message("progress.title.commit"), false, mySvnVcs.getProject());
}
else {
doCommit(committables, preparedComment, exception, feedback);
}
return exception;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SvnCheckinEnvironment.java
示例15: getDefaultMessageFor
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
@Nullable
public String getDefaultMessageFor(FilePath[] filesToCheckin) {
LinkedHashSet<String> messages = ContainerUtil.newLinkedHashSet();
for (VirtualFile root : GitUtil.gitRoots(Arrays.asList(filesToCheckin))) {
VirtualFile mergeMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_MERGE_MSG);
VirtualFile squashMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_SQUASH_MSG);
try {
if (mergeMsg == null && squashMsg == null) {
continue;
}
String encoding = GitConfigUtil.getCommitEncoding(myProject, root);
if (mergeMsg != null) {
messages.add(loadMessage(mergeMsg, encoding));
}
else {
messages.add(loadMessage(squashMsg, encoding));
}
}
catch (IOException e) {
if (log.isDebugEnabled()) {
log.debug("Unable to load merge message", e);
}
}
}
return DvcsUtil.joinMessagesOrNull(messages);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GitCheckinEnvironment.java
示例16: collectPaths
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
@NotNull
private Set<FilePath> collectPaths(@NotNull List<CommittedChangeList> lists) {
Set<FilePath> result = new HashSet<FilePath>();
for (CommittedChangeList list : lists) {
SvnChangeList svnList = (SvnChangeList)list;
for (String path : svnList.getAffectedPaths()) {
File localPath = getLocalPath(path);
if (localPath != null) {
result.add(VcsUtil.getFilePath(localPath, false));
}
}
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:LocalChangesPromptTask.java
示例17: create
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
@NotNull
public static ApplyPatchForBaseRevisionTexts create(final Project project, final VirtualFile file, final FilePath pathBeforeRename,
final TextFilePatch patch, final Getter<CharSequence> baseContents) {
assert ! patch.isNewFile();
final String beforeVersionId = patch.getBeforeVersionId();
DefaultPatchBaseVersionProvider provider = null;
if (beforeVersionId != null) {
provider = new DefaultPatchBaseVersionProvider(project, file, beforeVersionId);
}
if (provider != null && provider.canProvideContent()) {
return new ApplyPatchForBaseRevisionTexts(provider, pathBeforeRename, patch, file, baseContents);
} else {
return new ApplyPatchForBaseRevisionTexts(null, pathBeforeRename, patch, file, baseContents);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ApplyPatchForBaseRevisionTexts.java
示例18: createPath
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
public static FilePath createPath(@NotNull VirtualFile vcsRoot, @NotNull String path,
boolean isDeleted, boolean canBeDeleted, boolean unescapePath) throws VcsException {
final String absolutePath = makeAbsolutePath(vcsRoot, path, unescapePath);
FilePath file = isDeleted ? VcsUtil.getFilePathForDeletedFile(absolutePath, false) : VcsUtil.getFilePath(absolutePath, false);
if (canBeDeleted && (! SystemInfo.isFileSystemCaseSensitive) && VcsFilePathUtil.caseDiffers(file.getPath(), absolutePath)) {
// as for deleted file
file = VcsUtil.getFilePath(absolutePath, false);
}
return file;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GitContentRevision.java
示例19: getChange
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
@Override
public Change getChange(FilePath file) {
for (Change change : getAllChanges()) {
ContentRevision before = change.getBeforeRevision();
ContentRevision after = change.getAfterRevision();
if (after != null && after.getFile().equals(file) || before != null && before.getFile().equals(file)) {
return change;
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:MockChangeListManager.java
示例20: getAffectedChanges
import com.intellij.openapi.vcs.FilePath; //导入依赖的package包/类
@NotNull
@Override
protected List<Change> getAffectedChanges(@NotNull FilePath path, @NotNull SvnFileRevision rev) throws VcsException {
// Diff with zero revision is used here to get just affected changes under the path, and not all affected changes of the revision.
SvnTarget target1 = SvnTarget.fromURL(SvnUtil.createUrl(rev.getURL()), SVNRevision.create(0));
SvnTarget target2 = SvnTarget.fromURL(SvnUtil.createUrl(rev.getURL()), rev.getRevision());
return executeDiff(path, target1, target2);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SvnDiffFromHistoryHandler.java
注:本文中的com.intellij.openapi.vcs.FilePath类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论