use of com.intellij.openapi.vcs.AbstractVcs in project intellij-community by JetBrains.
the class VcsContentAnnotationImpl method fileRecentlyChanged.
@Nullable
@Override
public VcsRevisionNumber fileRecentlyChanged(VirtualFile vf) {
final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
final AbstractVcs vcs = vcsManager.getVcsFor(vf);
if (vcs == null)
return null;
if (vcs.getDiffProvider() instanceof DiffMixin) {
final VcsRevisionDescription description = ((DiffMixin) vcs.getDiffProvider()).getCurrentRevisionDescription(vf);
final Date date = description.getRevisionDate();
return isRecent(date) ? description.getRevisionNumber() : null;
}
return null;
}
use of com.intellij.openapi.vcs.AbstractVcs in project intellij-community by JetBrains.
the class AbstractShowDiffAction method isEnabled.
private static boolean isEnabled(@NotNull Project project, @NotNull VirtualFile file, @Nullable VcsBackgroundableActions actionKey) {
boolean result = false;
if (!file.isDirectory() && (actionKey == null || !BackgroundableActionLock.isLocked(project, actionKey, VcsBackgroundableActions.keyFrom(file)))) {
AbstractVcs vcs = ChangesUtil.getVcsForFile(file, project);
result = vcs != null && vcs.getDiffProvider() != null && AbstractVcs.fileInVcsByFileStatus(project, VcsUtil.getFilePath(file));
}
return result;
}
use of com.intellij.openapi.vcs.AbstractVcs in project intellij-community by JetBrains.
the class CheckinHandlersManagerImpl method getRegisteredCheckinHandlerFactories.
@Override
public List<BaseCheckinHandlerFactory> getRegisteredCheckinHandlerFactories(AbstractVcs<?>[] allActiveVcss) {
final List<BaseCheckinHandlerFactory> list = new ArrayList<>(myRegisteredBeforeCheckinHandlers.size() + allActiveVcss.length);
for (AbstractVcs vcs : allActiveVcss) {
final Collection<VcsCheckinHandlerFactory> factories = myVcsMap.get(vcs.getKeyInstanceMethod());
if (!factories.isEmpty()) {
list.addAll(factories);
}
}
list.addAll(myRegisteredBeforeCheckinHandlers);
return list;
}
use of com.intellij.openapi.vcs.AbstractVcs in project intellij-community by JetBrains.
the class VcsLogManager method findLogProviders.
@NotNull
public static Map<VirtualFile, VcsLogProvider> findLogProviders(@NotNull Collection<VcsRoot> roots, @NotNull Project project) {
Map<VirtualFile, VcsLogProvider> logProviders = ContainerUtil.newHashMap();
VcsLogProvider[] allLogProviders = Extensions.getExtensions(VcsLogProvider.LOG_PROVIDER_EP, project);
for (VcsRoot root : roots) {
AbstractVcs vcs = root.getVcs();
VirtualFile path = root.getPath();
if (vcs == null || path == null) {
LOG.error("Skipping invalid VCS root: " + root);
continue;
}
for (VcsLogProvider provider : allLogProviders) {
if (provider.getSupportedVcs().equals(vcs.getKeyInstanceMethod())) {
logProviders.put(path, provider);
break;
}
}
}
return logProviders;
}
use of com.intellij.openapi.vcs.AbstractVcs in project intellij-community by JetBrains.
the class VcsRootDetectorImpl method scanForRootsInsideDir.
@NotNull
private Set<VcsRoot> scanForRootsInsideDir(@NotNull final VirtualFile dir, final int depth) {
LOG.debug("Scanning inside [" + dir + "], depth = " + depth);
final Set<VcsRoot> roots = new HashSet<>();
if (depth > MAXIMUM_SCAN_DEPTH) {
// performance optimization via limitation: don't scan deep though the whole VFS, 2 levels under a content root is enough
return roots;
}
if (myProject.isDisposed() || !dir.isDirectory()) {
return roots;
}
List<AbstractVcs> vcsList = getVcsListFor(dir);
LOG.debug("Found following VCSs: " + vcsList);
for (AbstractVcs vcs : vcsList) {
roots.add(new VcsRoot(vcs, dir));
}
for (VirtualFile child : dir.getChildren()) {
roots.addAll(scanForRootsInsideDir(child, depth + 1));
}
return roots;
}
Aggregations