本文整理汇总了Java中com.intellij.openapi.vcs.FilePath类的典型用法代码示例。如果您正苦于以下问题:Java FilePath类的具体用法?Java FilePath怎么用?Java FilePath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FilePath类属于com.intellij.openapi.vcs包,在下文中一共展示了FilePath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
}
示例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;
}
示例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);
}
示例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;
}
示例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()));
}
}
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
});
}
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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();
}
}
示例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;
}
示例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);
}