use of com.intellij.openapi.vcs.VcsRoot in project intellij-community by JetBrains.
the class VcsRootDetectorImpl method scanForSingleRootAboveDir.
@NotNull
private List<VcsRoot> scanForSingleRootAboveDir(@NotNull final VirtualFile dir) {
List<VcsRoot> roots = new ArrayList<>();
if (myProject.isDisposed()) {
return roots;
}
VirtualFile par = dir.getParent();
while (par != null) {
List<AbstractVcs> vcsList = getVcsListFor(par);
for (AbstractVcs vcs : vcsList) {
roots.add(new VcsRoot(vcs, par));
}
if (!roots.isEmpty()) {
return roots;
}
par = par.getParent();
}
return roots;
}
use of com.intellij.openapi.vcs.VcsRoot in project intellij-community by JetBrains.
the class GitShowExternalLogAction method createManagerAndContent.
@NotNull
private static MyContentComponent createManagerAndContent(@NotNull Project project, @NotNull final GitVcs vcs, @NotNull final List<VirtualFile> roots, @Nullable String tabName) {
final GitRepositoryManager repositoryManager = GitRepositoryManager.getInstance(project);
for (VirtualFile root : roots) {
repositoryManager.addExternalRepository(root, GitRepositoryImpl.getInstance(root, project, true));
}
VcsLogManager manager = new VcsLogManager(project, ServiceManager.getService(project, VcsLogTabsProperties.class), ContainerUtil.map(roots, root -> new VcsRoot(vcs, root)));
return new MyContentComponent(manager.createLogPanel(calcLogId(roots), tabName), roots, () -> {
for (VirtualFile root : roots) {
repositoryManager.removeExternalRepository(root);
}
});
}
use of com.intellij.openapi.vcs.VcsRoot in project intellij-community by JetBrains.
the class IdeaTextPatchBuilder method revisionsConvertor.
public static List<BeforeAfter<AirContentRevision>> revisionsConvertor(final Project project, final List<Change> changes) throws VcsException {
final List<BeforeAfter<AirContentRevision>> result = new ArrayList<>(changes.size());
Map<VcsRoot, List<Change>> byRoots = groupByRoots(project, changes, change -> chooseNotNull(getBeforePath(change), getAfterPath(change)));
for (VcsRoot root : byRoots.keySet()) {
final Collection<Change> rootChanges = byRoots.get(root);
if (root.getVcs() == null || root.getVcs().getOutgoingChangesProvider() == null) {
addConvertChanges(rootChanges, result);
continue;
}
final VcsOutgoingChangesProvider<?> provider = root.getVcs().getOutgoingChangesProvider();
final Collection<Change> basedOnLocal = provider.filterLocalChangesBasedOnLocalCommits(rootChanges, root.getPath());
rootChanges.removeAll(basedOnLocal);
addConvertChanges(rootChanges, result);
for (Change change : basedOnLocal) {
// dates are here instead of numbers
result.add(new BeforeAfter<>(convertRevision(change.getBeforeRevision(), provider), convertRevision(change.getAfterRevision(), provider)));
}
}
return result;
}
use of com.intellij.openapi.vcs.VcsRoot in project intellij-community by JetBrains.
the class RemoteRevisionsNumbersCache method invalidate.
public void invalidate(final Collection<String> paths) {
synchronized (myLock) {
for (String path : paths) {
final Pair<VcsRoot, VcsRevisionNumber> pair = myData.remove(path);
if (pair != null) {
// vcs [root] seems to not change
final VcsRoot vcsRoot = pair.getFirst();
final LazyRefreshingSelfQueue<String> queue = getQueue(vcsRoot);
queue.forceRemove(path);
queue.addRequest(path);
myData.put(path, Pair.create(vcsRoot, NOT_LOADED));
}
}
}
}
use of com.intellij.openapi.vcs.VcsRoot in project intellij-community by JetBrains.
the class RemoteRevisionsNumbersCache method minus.
public void minus(Pair<String, AbstractVcs> pair) {
// does not support
if (pair.getSecond().getDiffProvider() == null)
return;
final VirtualFile root = getRootForPath(pair.getFirst());
if (root == null)
return;
final LazyRefreshingSelfQueue<String> queue;
final String key = pair.getFirst();
synchronized (myLock) {
queue = getQueue(new VcsRoot(pair.getSecond(), root));
myData.remove(key);
}
queue.forceRemove(key);
}
Aggregations