use of org.netbeans.lib.cvsclient.file.DirectoryObject in project intellij-community by JetBrains.
the class DirectoryPruner method pruneEmptyDirectories.
// Actions ================================================================
/**
* Remove any directories that don't contain any files
*/
public final void pruneEmptyDirectories() throws IOException {
while (directoriesToScan.size() > 0) {
final DirectoryObject directoryObject = (DirectoryObject) directoriesToScan.remove(0);
pruneEmptyDirectory(directoryObject);
}
}
use of org.netbeans.lib.cvsclient.file.DirectoryObject in project intellij-community by JetBrains.
the class FileSystemScanner method scanDirectory.
private List<DirectoryObject> scanDirectory(DirectoryObject directoryObject, CvsFiles cvsFiles) throws IOException {
if (!clientEnvironment.getLocalFileReader().exists(directoryObject, clientEnvironment.getCvsFileSystem())) {
return Collections.emptyList();
}
cvsFiles.add(CvsFile.createCvsDirectory(directoryObject));
final Set<String> subDirectoryNames = new HashSet<>();
final LocalFiles localFiles = new LocalFiles(directoryObject, clientEnvironment);
// get all the entries we know about, and process them
final Collection<Entry> entries = clientEnvironment.getAdminReader().getEntries(directoryObject, clientEnvironment.getCvsFileSystem());
for (final Entry entry : entries) {
if (entry.isDirectory()) {
subDirectoryNames.add(entry.getFileName());
} else {
final FileObject fileObject = FileObject.createInstance(directoryObject, entry.getFileName());
final boolean fileExists = clientEnvironment.getLocalFileReader().exists(fileObject, clientEnvironment.getCvsFileSystem());
cvsFiles.add(CvsFile.createCvsFileForEntry(fileObject, entry, fileExists));
localFiles.removeFile(entry.getFileName());
}
}
for (final String fileName : localFiles.getFileNames()) {
cvsFiles.add(CvsFile.createCvsFileForExistingFile(FileObject.createInstance(directoryObject, fileName)));
}
final List<DirectoryObject> subDirectories = new ArrayList<>(subDirectoryNames.size());
for (final String directoryName : subDirectoryNames) {
subDirectories.add(DirectoryObject.createInstance(directoryObject, directoryName));
}
return subDirectories;
}
use of org.netbeans.lib.cvsclient.file.DirectoryObject in project intellij-community by JetBrains.
the class FileSystemScanner method scanDirectories.
// Utils ==================================================================
private void scanDirectories(DirectoryObject rootDirectoryObject, CvsFiles cvsFiles) throws IOException {
final List<DirectoryObject> directories = new LinkedList<>();
directories.add(rootDirectoryObject);
while (directories.size() > 0) {
final DirectoryObject directoryObject = directories.remove(0);
final List<DirectoryObject> subDirectories = scanDirectory(directoryObject, cvsFiles);
if (recursive) {
directories.addAll(subDirectories);
}
}
}
use of org.netbeans.lib.cvsclient.file.DirectoryObject in project intellij-community by JetBrains.
the class AddCommand method addDirectoryRequestsUpToLocalDirectory.
private DirectoryObject addDirectoryRequestsUpToLocalDirectory(DirectoryObject directoryObject, Requests requests, IRequestProcessor requestProcessor, IClientEnvironment clientEnvironment) {
final DirectoryObject parentDirectoryObject = directoryObject.getParent();
if (parentDirectoryObject == null) {
return null;
}
DirectoryObject parentDirectoryUnderCvsControl;
if (clientEnvironment.getAdminReader().hasCvsDirectory(parentDirectoryObject, clientEnvironment.getCvsFileSystem())) {
parentDirectoryUnderCvsControl = parentDirectoryObject;
requests.addDirectoryRequest(DirectoryObject.getRoot());
addDirectoryRequest(parentDirectoryUnderCvsControl, requests);
} else {
parentDirectoryUnderCvsControl = addDirectoryRequestsUpToLocalDirectory(parentDirectoryObject, requests, requestProcessor, clientEnvironment);
if (parentDirectoryUnderCvsControl == null) {
parentDirectoryUnderCvsControl = parentDirectoryObject;
}
}
addDirectoryRequest(directoryObject, requests);
return parentDirectoryObject;
}
use of org.netbeans.lib.cvsclient.file.DirectoryObject in project intellij-community by JetBrains.
the class AddCommand method addRequestsForFile.
private void addRequestsForFile(FileObject fileObject, Requests requests, IClientEnvironment clientEnvironment) throws IOException {
final DirectoryObject parentDirectory = fileObject.getParent();
addDirectoryRequest(parentDirectory, requests);
addStickyRequest(parentDirectory, requests, clientEnvironment.getCvsFileSystem(), clientEnvironment);
final Entry entry = clientEnvironment.getAdminReader().getEntry(fileObject, clientEnvironment.getCvsFileSystem());
if (entry != null) {
requests.addEntryRequest(entry);
} else {
requests.addIsModifiedRequest(fileObject);
}
}
Aggregations