use of org.netbeans.lib.cvsclient.admin.Entry in project intellij-community by JetBrains.
the class CvsChangeProvider method getUpToDateTimeForFile.
public long getUpToDateTimeForFile(@NotNull VirtualFile vFile) {
final Entry entry = myEntriesManager.getEntryFor(vFile.getParent(), vFile.getName());
if (entry == null)
return -1;
// retrieve of any file version in time is not correct since update/merge was applie3d to already modified file
/*if (entry.isResultOfMerge()) {
long resultForMerge = CvsUtil.getUpToDateDateForFile(vFile);
if (resultForMerge > 0) {
return resultForMerge;
}
}*/
final Date lastModified = entry.getLastModified();
if (lastModified == null)
return -1;
return lastModified.getTime();
}
use of org.netbeans.lib.cvsclient.admin.Entry in project intellij-community by JetBrains.
the class CvsChangeProvider method processEntriesIn.
private void processEntriesIn(@NotNull VirtualFile dir, VcsDirtyScope scope, ChangelistBuilder builder, boolean recursively, Collection<VirtualFile> cvsRoots, final ProgressIndicator progress) throws VcsException {
final FilePath path = VcsContextFactory.SERVICE.getInstance().createFilePathOn(dir);
if (!scope.belongsTo(path)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Skipping out of scope path " + path);
}
return;
}
final DirectoryContent dirContent = getDirectoryContent(dir, progress);
for (VirtualFile file : dirContent.getUnknownFiles()) {
builder.processUnversionedFile(file);
}
for (VirtualFile file : dirContent.getIgnoredFiles()) {
builder.processIgnoredFile(file);
}
for (Entry entry : dirContent.getDeletedDirectories()) {
builder.processLocallyDeletedFile(VcsUtil.getFilePath(CvsVfsUtil.getFileFor(dir, entry.getFileName()), true));
}
for (Entry entry : dirContent.getDeletedFiles()) {
builder.processLocallyDeletedFile(VcsUtil.getFilePath(CvsVfsUtil.getFileFor(dir, entry.getFileName()), false));
}
/*
final Collection<VirtualFile> unknownDirs = dirContent.getUnknownDirectories();
for (VirtualFile file : unknownDirs) {
builder.processUnversionedFile(file);
}
*/
progress.checkCanceled();
checkSwitchedDir(dir, builder, scope, cvsRoots);
if (CvsUtil.fileIsUnderCvs(dir) && dir.getChildren().length == 1 && /* admin dir */
dirContent.getDeletedFiles().isEmpty() && hasRemovedFiles(dirContent.getFiles())) {
// directory is going to be deleted
builder.processChange(new Change(CurrentContentRevision.create(path), CurrentContentRevision.create(path), FileStatus.DELETED), CvsVcs2.getKey());
}
for (VirtualFileEntry fileEntry : dirContent.getFiles()) {
processFile(dir, fileEntry.getVirtualFile(), fileEntry.getEntry(), builder, progress);
}
if (recursively) {
for (VirtualFile file : CvsVfsUtil.getChildrenOf(dir)) {
progress.checkCanceled();
if (file.isDirectory()) {
if (!myVcsManager.isIgnored(file)) {
processEntriesIn(file, scope, builder, true, cvsRoots, progress);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Skipping ignored path " + file.getPath());
}
}
}
}
}
}
use of org.netbeans.lib.cvsclient.admin.Entry in project intellij-community by JetBrains.
the class AdminReaderOnCache method getEntries.
public Collection<Entry> getEntries(final DirectoryObject directoryObject, final ICvsFileSystem cvsFileSystem) throws IOException {
setProgressText(CvsBundle.message("progress.text.scanning.directory", cvsFileSystem.getLocalFileSystem().getFile(directoryObject).getAbsolutePath()));
ProgressManager.checkCanceled();
File parent = cvsFileSystem.getAdminFileSystem().getFile(directoryObject);
Collection<Entry> entries = myCvsEntriesManager.getEntriesIn(CvsVfsUtil.findFileByIoFile(parent));
ArrayList<Entry> copy = new ArrayList<>();
for (final Entry entry : entries) {
try {
copy.add((Entry) entry.clone());
} catch (CloneNotSupportedException e) {
LOG.error(e);
}
}
return copy;
}
use of org.netbeans.lib.cvsclient.admin.Entry in project intellij-community by JetBrains.
the class CvsRollbackEnvironment method restoreFileFromCache.
private boolean restoreFileFromCache(VirtualFile parent, String name) {
final Entry entry = CvsEntriesManager.getInstance().getEntryFor(parent, name);
final String revision = entry.getRevision();
if (revision == null) {
return false;
}
final boolean makeReadOnly = CvsConfiguration.getInstance(myProject).MAKE_NEW_FILES_READONLY;
return CvsUtil.restoreFileFromCachedContent(parent, name, revision, makeReadOnly);
}
use of org.netbeans.lib.cvsclient.admin.Entry in project intellij-community by JetBrains.
the class CommandCvsHandler method createRestoreFileHandler.
public static CvsHandler createRestoreFileHandler(final VirtualFile parent, String name, boolean makeNewFilesReadOnly) {
final File ioFile = new File(VfsUtilCore.virtualToIoFile(parent), name);
final Entry entry = CvsEntriesManager.getInstance().getEntryFor(parent, name);
final String revision = getRevision(entry);
final CheckoutFileOperation operation = new CheckoutFileOperation(parent, new SimpleRevision(revision), name, makeNewFilesReadOnly);
final CommandCvsHandler cvsHandler = new CommandCvsHandler(CvsBundle.message("operation.name.restore"), operation, FileSetToBeUpdated.EMPTY);
operation.addFinishAction(() -> {
final List<VcsException> errors = cvsHandler.getErrors();
if (errors != null && !errors.isEmpty())
return;
if (entry != null) {
entry.setRevision(revision);
entry.setConflict(CvsUtil.formatDate(new Date(ioFile.lastModified())));
try {
CvsUtil.saveEntryForFile(ioFile, entry);
} catch (IOException e) {
LOG.error(e);
}
CvsEntriesManager.getInstance().clearCachedEntriesFor(parent);
}
});
return cvsHandler;
}
Aggregations