Search in sources :

Example 1 with CvsConfiguration

use of com.intellij.cvsSupport2.config.CvsConfiguration in project intellij-community by JetBrains.

the class CvsUpdateEnvironment method createSettingsAndUpdateContext.

private static UpdateSettingsOnCvsConfiguration createSettingsAndUpdateContext(final CvsConfiguration cvsConfiguration, @NotNull final Ref<SequentialUpdatesContext> contextRef) {
    if (contextRef.get() != null) {
        final CvsSequentialUpdateContext cvsContext = (CvsSequentialUpdateContext) contextRef.get();
        contextRef.set(null);
        return cvsContext.getConfiguration();
    }
    if ((!cvsConfiguration.CLEAN_COPY) && cvsConfiguration.UPDATE_DATE_OR_REVISION_SETTINGS.overridesDefault() && (cvsConfiguration.MERGING_MODE != CvsConfiguration.DO_NOT_MERGE)) {
        // split into 2 updates
        final UpdateSettingsOnCvsConfiguration secondUpdate = new UpdateSettingsOnCvsConfiguration(cvsConfiguration.PRUNE_EMPTY_DIRECTORIES, cvsConfiguration.MERGING_MODE, cvsConfiguration.MERGE_WITH_BRANCH1_NAME, cvsConfiguration.MERGE_WITH_BRANCH2_NAME, cvsConfiguration.CREATE_NEW_DIRECTORIES, cvsConfiguration.UPDATE_KEYWORD_SUBSTITUTION, new DateOrRevisionSettings(), cvsConfiguration.MAKE_NEW_FILES_READONLY, cvsConfiguration.CLEAN_COPY, cvsConfiguration.RESET_STICKY);
        contextRef.set(new CvsSequentialUpdateContext(secondUpdate, cvsConfiguration.UPDATE_DATE_OR_REVISION_SETTINGS.asString()));
        return new UpdateSettingsOnCvsConfiguration(cvsConfiguration.PRUNE_EMPTY_DIRECTORIES, CvsConfiguration.DO_NOT_MERGE, null, null, cvsConfiguration.CREATE_NEW_DIRECTORIES, cvsConfiguration.UPDATE_KEYWORD_SUBSTITUTION, cvsConfiguration.UPDATE_DATE_OR_REVISION_SETTINGS, cvsConfiguration.MAKE_NEW_FILES_READONLY, cvsConfiguration.CLEAN_COPY, cvsConfiguration.RESET_STICKY);
    } else {
        // usual way
        return new UpdateSettingsOnCvsConfiguration(cvsConfiguration, cvsConfiguration.CLEAN_COPY, cvsConfiguration.RESET_STICKY);
    }
}
Also used : DateOrRevisionSettings(com.intellij.cvsSupport2.config.DateOrRevisionSettings) UpdateSettingsOnCvsConfiguration(com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration)

Example 2 with CvsConfiguration

use of com.intellij.cvsSupport2.config.CvsConfiguration in project intellij-community by JetBrains.

the class GetFileFromRepositoryAction method getCvsHandler.

protected CvsHandler getCvsHandler(CvsContext context) {
    CvsLightweightFile[] cvsLightweightFiles = context.getSelectedLightweightFiles();
    Project project = context.getProject();
    if (cvsLightweightFiles != null) {
        boolean makeNewFilesReadOnly = project != null && CvsConfiguration.getInstance(project).MAKE_NEW_FILES_READONLY;
        return CommandCvsHandler.createGetFileFromRepositoryHandler(cvsLightweightFiles, makeNewFilesReadOnly);
    }
    final FilePath[] filePaths = context.getSelectedFilePaths();
    if (filePaths != null) {
        CvsConfiguration cvsConfiguration = CvsConfiguration.getInstance(project);
        // do not use -j's
        final UpdateSettingsOnCvsConfiguration updateSettings = new UpdateSettingsOnCvsConfiguration(cvsConfiguration, cvsConfiguration.CLEAN_COPY, cvsConfiguration.RESET_STICKY);
        return CommandCvsHandler.createUpdateHandler(filePaths, updateSettings, project, UpdatedFiles.create());
    }
    return CvsHandler.NULL;
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) Project(com.intellij.openapi.project.Project) CvsConfiguration(com.intellij.cvsSupport2.config.CvsConfiguration) UpdateSettingsOnCvsConfiguration(com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration) CvsLightweightFile(com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile) UpdateSettingsOnCvsConfiguration(com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration)

Example 3 with CvsConfiguration

use of com.intellij.cvsSupport2.config.CvsConfiguration in project intellij-community by JetBrains.

the class MigrateCvsRootAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent event) {
    final VcsContext context = CvsContextWrapper.createInstance(event);
    final VirtualFile selectedFile = context.getSelectedFile();
    final Project project = context.getProject();
    final MigrateRootDialog dialog = new MigrateRootDialog(project, selectedFile);
    if (!dialog.showAndGet()) {
        return;
    }
    final File directory = dialog.getSelectedDirectory();
    final boolean shouldReplaceAllRoots = dialog.shouldReplaceAllRoots();
    final List<File> rootFiles = new ArrayList<>();
    try {
        if (shouldReplaceAllRoots) {
            collectRootFiles(directory, null, rootFiles);
        } else {
            collectRootFiles(directory, dialog.getCvsRoot(), rootFiles);
        }
    } catch (IOException e) {
        LOG.error(e);
        return;
    }
    final CvsRootConfiguration cvsConfiguration = dialog.getSelectedCvsConfiguration();
    final String cvsRoot = cvsConfiguration.getCvsRootAsString();
    for (final File file : rootFiles) {
        try {
            FileUtils.writeLine(file, cvsRoot);
        } catch (IOException e) {
            LOG.error(e);
            break;
        }
    }
    final AccessToken token = ApplicationManager.getApplication().acquireReadActionLock();
    try {
        for (File file : rootFiles) {
            CvsVfsUtil.findFileByIoFile(file).refresh(true, false);
        }
    } finally {
        token.finish();
    }
    StatusBar.Info.set("Finished migrating CVS root to " + cvsRoot, project);
}
Also used : VcsContext(com.intellij.openapi.vcs.actions.VcsContext) VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) AccessToken(com.intellij.openapi.application.AccessToken) ArrayList(java.util.ArrayList) MigrateRootDialog(com.intellij.cvsSupport2.ui.MigrateRootDialog) IOException(java.io.IOException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) CvsRootConfiguration(com.intellij.cvsSupport2.config.CvsRootConfiguration)

Example 4 with CvsConfiguration

use of com.intellij.cvsSupport2.config.CvsConfiguration in project intellij-community by JetBrains.

the class CvsCheckinEnvironment method commit.

public List<VcsException> commit(List<Change> changes, String preparedComment, @NotNull NullableFunction<Object, Object> parametersHolder, Set<String> feedback) {
    final Collection<FilePath> filesList = ChangesUtil.getPaths(changes);
    FilePath[] files = filesList.toArray(new FilePath[filesList.size()]);
    final CvsOperationExecutor executor = new CvsOperationExecutor(myProject);
    executor.setShowErrors(false);
    final List<File> dirsToPrune = new ArrayList<>();
    for (Change c : changes) {
        if (c.getType() == Change.Type.DELETED) {
            final ContentRevision contentRevision = c.getBeforeRevision();
            assert contentRevision != null;
            final FilePath path = contentRevision.getFile();
            final FilePath parentPath = path.getParentPath();
            if (parentPath != null) {
                dirsToPrune.add(parentPath.getIOFile());
            }
        }
    }
    final CvsConfiguration cvsConfiguration = CvsConfiguration.getInstance(myProject);
    CvsHandler handler = CommandCvsHandler.createCommitHandler(files, preparedComment, CvsBundle.message("operation.name.commit.file", files.length), cvsConfiguration.MAKE_NEW_FILES_READONLY, myProject, cvsConfiguration.TAG_AFTER_PROJECT_COMMIT, cvsConfiguration.TAG_AFTER_PROJECT_COMMIT_NAME, dirsToPrune);
    executor.performActionSync(handler, CvsOperationExecutorCallback.EMPTY);
    return executor.getResult().getErrorsAndWarnings();
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) CvsConfiguration(com.intellij.cvsSupport2.config.CvsConfiguration) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler) CvsHandler(com.intellij.cvsSupport2.cvshandlers.CvsHandler) CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) Change(com.intellij.openapi.vcs.changes.Change) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 5 with CvsConfiguration

use of com.intellij.cvsSupport2.config.CvsConfiguration in project intellij-community by JetBrains.

the class UpdateOptionsPanel method reset.

public void reset() {
    CvsConfiguration config = CvsConfiguration.getInstance(myProject);
    myPruneEmptyDirectories.setSelected(config.PRUNE_EMPTY_DIRECTORIES);
    myDoNotMerge.setSelected(true);
    myBranch.setText(config.MERGE_WITH_BRANCH1_NAME);
    myBranch2.setText(config.MERGE_WITH_BRANCH2_NAME);
    mySwitchToHeadRevision.setSelected(false);
    myCreateNewDirectories.setSelected(config.CREATE_NEW_DIRECTORIES);
    myCleanCopy.setSelected(false);
    myDateOrRevisionOrTagSettings.updateFrom(config.UPDATE_DATE_OR_REVISION_SETTINGS);
    for (JRadioButton jRadioButton : myMergingGroup) {
        jRadioButton.addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(ItemEvent e) {
                enableBranchField();
            }
        });
    }
    enableBranchField();
}
Also used : CvsConfiguration(com.intellij.cvsSupport2.config.CvsConfiguration) ItemEvent(java.awt.event.ItemEvent) ItemListener(java.awt.event.ItemListener)

Aggregations

CvsConfiguration (com.intellij.cvsSupport2.config.CvsConfiguration)6 UpdateSettingsOnCvsConfiguration (com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 CvsOperationExecutor (com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor)2 CommandCvsHandler (com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)2 Project (com.intellij.openapi.project.Project)2 FilePath (com.intellij.openapi.vcs.FilePath)2 File (java.io.File)2 CvsLightweightFile (com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile)1 CvsRootConfiguration (com.intellij.cvsSupport2.config.CvsRootConfiguration)1 DateOrRevisionSettings (com.intellij.cvsSupport2.config.DateOrRevisionSettings)1 CvsHandler (com.intellij.cvsSupport2.cvshandlers.CvsHandler)1 UpdateHandler (com.intellij.cvsSupport2.cvshandlers.UpdateHandler)1 WatchOperation (com.intellij.cvsSupport2.cvsoperations.cvsWatch.WatchOperation)1 WatcherDialog (com.intellij.cvsSupport2.cvsoperations.cvsWatch.ui.WatcherDialog)1 KeywordSubstitutionWrapper (com.intellij.cvsSupport2.keywordSubstitution.KeywordSubstitutionWrapper)1 MigrateRootDialog (com.intellij.cvsSupport2.ui.MigrateRootDialog)1 UpdatedFilesProcessor (com.intellij.cvsSupport2.updateinfo.UpdatedFilesProcessor)1 AccessToken (com.intellij.openapi.application.AccessToken)1 CvsResult (com.intellij.openapi.cvsIntegration.CvsResult)1