use of org.netbeans.lib.cvsclient.file.ICvsFileSystem in project intellij-community by JetBrains.
the class CheckoutCommand method processExistingModules.
private void processExistingModules(ExpandedModules expandedModules, IClientEnvironment clientEnvironment) {
final ICvsFileSystem cvsFileSystem = clientEnvironment.getCvsFileSystem();
for (final String moduleName : expandedModules.getModules()) {
if (moduleName.equals(".")) {
addFileObject(DirectoryObject.getRoot());
break;
}
final File moduleFile = cvsFileSystem.getLocalFileSystem().getFile(moduleName);
final AbstractFileObject abstractFileObject;
final DirectoryObject directoryObject;
if (moduleFile.isFile()) {
abstractFileObject = cvsFileSystem.getLocalFileSystem().getFileObject(moduleFile);
directoryObject = abstractFileObject.getParent();
} else {
directoryObject = cvsFileSystem.getLocalFileSystem().getDirectoryObject(moduleFile);
abstractFileObject = directoryObject;
}
if (clientEnvironment.getAdminReader().hasCvsDirectory(directoryObject, cvsFileSystem)) {
addFileObject(abstractFileObject);
}
}
}
use of org.netbeans.lib.cvsclient.file.ICvsFileSystem in project intellij-community by JetBrains.
the class DirectoryPruner method pruneEmptyDirectory.
// Utils ==================================================================
private boolean pruneEmptyDirectory(DirectoryObject directoryObject) throws IOException {
final ILocalFileReader localFileReader = clientEnvironment.getLocalFileReader();
final ICvsFileSystem cvsFileSystem = clientEnvironment.getCvsFileSystem();
final IAdminWriter adminWriter = clientEnvironment.getAdminWriter();
final IAdminReader adminReader = clientEnvironment.getAdminReader();
directoriesToScan.remove(directoryObject);
if (!localFileReader.exists(directoryObject, cvsFileSystem)) {
return true;
}
final List fileNames = new ArrayList();
final List directoryNames = new ArrayList();
localFileReader.listFilesAndDirectories(directoryObject, fileNames, directoryNames, cvsFileSystem);
if (fileNames.size() > 0) {
return false;
}
if (hasFileEntry(directoryObject, cvsFileSystem, adminReader)) {
return false;
}
for (Iterator it = directoryNames.iterator(); it.hasNext(); ) {
final String directoryName = (String) it.next();
if (!pruneEmptyDirectory(DirectoryObject.createInstance(directoryObject, directoryName))) {
return false;
}
}
if (adminReader.hasCvsDirectory(directoryObject, cvsFileSystem)) {
try {
adminWriter.removeEntryForFile(directoryObject, cvsFileSystem);
} catch (FileNotFoundException ex) {
// ignore
return false;
}
adminWriter.pruneDirectory(directoryObject, cvsFileSystem);
return true;
}
return false;
}
use of org.netbeans.lib.cvsclient.file.ICvsFileSystem in project intellij-community by JetBrains.
the class ImportTree method getIgnoreFileFilter.
public IIgnoreFileFilter getIgnoreFileFilter() {
final Collection<File> excludedFiles = new HashSet<>();
for (final VirtualFile excludedFile : myExcludedFiles) {
excludedFiles.add(CvsVfsUtil.getFileFor(excludedFile));
}
final Collection<File> includedFiles = new HashSet<>();
for (VirtualFile includedFile : myIncludedFiles) {
includedFiles.add(CvsVfsUtil.getFileFor(includedFile));
}
return new IIgnoreFileFilter() {
private final Map<File, IgnoredFilesInfo> myParentToIgnoresMap = new HashMap<>();
public boolean shouldBeIgnored(AbstractFileObject abstractFileObject, ICvsFileSystem cvsFileSystem) {
final File file = cvsFileSystem.getLocalFileSystem().getFile(abstractFileObject);
if (file.isDirectory() && file.getName().equals(CvsUtil.CVS))
return true;
if (FileTypeManager.getInstance().isFileIgnored(abstractFileObject.getName()))
return true;
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByIoFile(file);
if (myProject != null && !includedFiles.contains(file)) {
if (vFile != null && isIgnoredByVcs(vFile)) {
return true;
}
}
if (excludedFiles.contains(file))
return true;
final File parentFile = file.getParentFile();
if (parentFile == null)
return false;
if (!myParentToIgnoresMap.containsKey(parentFile)) {
myParentToIgnoresMap.put(parentFile, IgnoredFilesInfoImpl.createForFile(new File(parentFile, CvsUtil.CVS_IGNORE_FILE)));
}
return myParentToIgnoresMap.get(parentFile).shouldBeIgnored(vFile);
}
};
}
use of org.netbeans.lib.cvsclient.file.ICvsFileSystem in project intellij-community by JetBrains.
the class ExportCommand method processExistingModules.
private void processExistingModules(ExpandedModules expandedModules, IClientEnvironment clientEnvironment) {
final ICvsFileSystem cvsFileSystem = clientEnvironment.getCvsFileSystem();
for (Iterator it = expandedModules.getModules().iterator(); it.hasNext(); ) {
final String moduleName = (String) it.next();
if (moduleName.equals(".")) {
addFileObject(DirectoryObject.getRoot());
break;
}
final File moduleFile = cvsFileSystem.getLocalFileSystem().getFile(moduleName);
final AbstractFileObject abstractFileObject;
final DirectoryObject directoryObject;
if (moduleFile.isFile()) {
abstractFileObject = cvsFileSystem.getLocalFileSystem().getFileObject(moduleFile);
directoryObject = abstractFileObject.getParent();
} else {
directoryObject = cvsFileSystem.getLocalFileSystem().getDirectoryObject(moduleFile);
abstractFileObject = directoryObject;
}
if (clientEnvironment.getAdminReader().hasCvsDirectory(directoryObject, cvsFileSystem)) {
addFileObject(abstractFileObject);
}
}
}
Aggregations