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());
}
}
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;
}
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;
}
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;
}
}
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);
}
Aggregations