Search in sources :

Example 6 with UpdatedFiles

use of com.intellij.openapi.vcs.update.UpdatedFiles in project intellij-community by JetBrains.

the class GitMergeUtil method showUpdates.

/**
   * Show updates caused by git operation
   *
   * @param project     the context project
   * @param exceptions  the exception list
   * @param root        the git root
   * @param currentRev  the revision before update
   * @param beforeLabel the local history label before update
   * @param actionName  the action name
   * @param actionInfo  the information about the action
   */
public static void showUpdates(final Project project, final List<VcsException> exceptions, final VirtualFile root, final GitRevisionNumber currentRev, final Label beforeLabel, final String actionName, final ActionInfo actionInfo) {
    UpdatedFiles files = UpdatedFiles.create();
    MergeChangeCollector collector = new MergeChangeCollector(project, root, currentRev);
    collector.collect(files, exceptions);
    if (!exceptions.isEmpty())
        return;
    GuiUtils.invokeLaterIfNeeded(() -> {
        ProjectLevelVcsManagerEx manager = (ProjectLevelVcsManagerEx) ProjectLevelVcsManager.getInstance(project);
        UpdateInfoTree tree = manager.showUpdateProjectInfo(files, actionName, actionInfo, false);
        tree.setBefore(beforeLabel);
        tree.setAfter(LocalHistory.getInstance().putSystemLabel(project, "After update"));
    }, ModalityState.defaultModalityState());
    Collection<String> unmergedNames = files.getGroupById(FileGroup.MERGED_WITH_CONFLICT_ID).getFiles();
    if (!unmergedNames.isEmpty()) {
        List<VirtualFile> unmerged = mapNotNull(unmergedNames, name -> LocalFileSystem.getInstance().findFileByPath(name));
        GuiUtils.invokeLaterIfNeeded(() -> {
            GitVcs vcs = GitVcs.getInstance(project);
            if (vcs != null) {
                AbstractVcsHelper.getInstance(project).showMergeDialog(unmerged, vcs.getMergeProvider());
            }
        }, ModalityState.defaultModalityState());
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) GitVcs(git4idea.GitVcs) ProjectLevelVcsManagerEx(com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx) UpdatedFiles(com.intellij.openapi.vcs.update.UpdatedFiles) UpdateInfoTree(com.intellij.openapi.vcs.update.UpdateInfoTree)

Example 7 with UpdatedFiles

use of com.intellij.openapi.vcs.update.UpdatedFiles in project intellij-community by JetBrains.

the class CvsUpdatePolicy method createUpdatedFiles.

public static UpdatedFiles createUpdatedFiles() {
    UpdatedFiles result = UpdatedFiles.create();
    fillGroups(result);
    return result;
}
Also used : UpdatedFiles(com.intellij.openapi.vcs.update.UpdatedFiles)

Example 8 with UpdatedFiles

use of com.intellij.openapi.vcs.update.UpdatedFiles in project intellij-community by JetBrains.

the class HgUpdateTest method updateThroughPlugin.

private List<VcsException> updateThroughPlugin() throws VcsException {
    HgRegularUpdater updater = new HgRegularUpdater(myProject, projectRepoVirtualFile, new HgUpdateConfigurationSettings());
    UpdatedFiles updatedFiles = UpdatedFiles.create();
    EmptyProgressIndicator indicator = new EmptyProgressIndicator();
    ArrayList<VcsException> nonFatalWarnings = new ArrayList<>();
    updater.update(updatedFiles, indicator, nonFatalWarnings);
    return nonFatalWarnings;
}
Also used : HgUpdateConfigurationSettings(org.zmlx.hg4idea.provider.update.HgUpdateConfigurationSettings) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) HgRegularUpdater(org.zmlx.hg4idea.provider.update.HgRegularUpdater) VcsException(com.intellij.openapi.vcs.VcsException) ArrayList(java.util.ArrayList) UpdatedFiles(com.intellij.openapi.vcs.update.UpdatedFiles)

Example 9 with UpdatedFiles

use of com.intellij.openapi.vcs.update.UpdatedFiles in project intellij-community by JetBrains.

the class SvnNativeClientAuthTest method updateSimple.

private void updateSimple(File wc1) {
    Assert.assertTrue(wc1.isDirectory());
    final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1);
    final UpdatedFiles files = UpdatedFiles.create();
    final UpdateSession session = myVcs.getUpdateEnvironment().updateDirectories(new FilePath[] { VcsUtil.getFilePath(vf) }, files, new EmptyProgressIndicator(), new Ref<>());
    Assert.assertTrue(session.getExceptions() == null || session.getExceptions().isEmpty());
    Assert.assertTrue(!session.isCanceled());
    if (myIsSecure) {
        ++myExpectedCreds;
        ++myExpectedCert;
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) UpdateSession(com.intellij.openapi.vcs.update.UpdateSession) UpdatedFiles(com.intellij.openapi.vcs.update.UpdatedFiles)

Example 10 with UpdatedFiles

use of com.intellij.openapi.vcs.update.UpdatedFiles in project intellij-community by JetBrains.

the class SvnProtocolsTest method testUpdateImpl.

// todo this test writes to repository - so it's disabled for now - while admins are preparing a server
/*
  @Test
  public void testUpdateAndCommit() throws Exception {
    for (String url : ourTestURL) {
      final File wc1 = testCheckoutImpl(url);
      final File wc2 = testCheckoutImpl(url);

      final File file = testCommitImpl(wc1);
      System.out.println("Committed file: " + file.getPath());
      testUpdateImpl(wc2, file);
    }
  }*/
private void testUpdateImpl(File wc1, final File created) {
    Assert.assertTrue(wc1.isDirectory());
    final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1);
    final UpdatedFiles files = UpdatedFiles.create();
    final UpdateSession session = myVcs.getUpdateEnvironment().updateDirectories(new FilePath[] { VcsUtil.getFilePath(vf) }, files, new EmptyProgressIndicator(), new Ref<>());
    Assert.assertTrue(session.getExceptions() == null || session.getExceptions().isEmpty());
    Assert.assertTrue(!session.isCanceled());
    Assert.assertTrue(!files.getGroupById(FileGroup.CREATED_ID).getFiles().isEmpty());
    final String path = files.getGroupById(FileGroup.CREATED_ID).getFiles().iterator().next();
    final String name = path.substring(path.lastIndexOf(File.separator) + 1);
    Assert.assertEquals(created.getName(), name);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) UpdateSession(com.intellij.openapi.vcs.update.UpdateSession) UpdatedFiles(com.intellij.openapi.vcs.update.UpdatedFiles)

Aggregations

UpdatedFiles (com.intellij.openapi.vcs.update.UpdatedFiles)11 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)4 UpdateSession (com.intellij.openapi.vcs.update.UpdateSession)3 Project (com.intellij.openapi.project.Project)2 VcsException (com.intellij.openapi.vcs.VcsException)2 NotificationGroup (com.intellij.notification.NotificationGroup)1 NotificationType (com.intellij.notification.NotificationType)1 ProjectLevelVcsManagerEx (com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx)1 UpdateInfoTree (com.intellij.openapi.vcs.update.UpdateInfoTree)1 GitVcs (git4idea.GitVcs)1 GitRepository (git4idea.repo.GitRepository)1 GitUpdateResult (git4idea.update.GitUpdateResult)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1 HgCommandResultNotifier (org.zmlx.hg4idea.action.HgCommandResultNotifier)1 HgCommitCommand (org.zmlx.hg4idea.command.HgCommitCommand)1 HgGraftCommand (org.zmlx.hg4idea.command.HgGraftCommand)1 HgCommandException (org.zmlx.hg4idea.execution.HgCommandException)1 HgCommandResult (org.zmlx.hg4idea.execution.HgCommandResult)1