use of com.intellij.openapi.vcs.update.UpdatedFiles in project intellij-community by JetBrains.
the class HgCherryPicker method processGrafting.
private static void processGrafting(@NotNull HgRepository repository, @NotNull List<String> hashes) {
Project project = repository.getProject();
VirtualFile root = repository.getRoot();
HgGraftCommand command = new HgGraftCommand(project, repository);
HgCommandResult result = command.startGrafting(hashes);
boolean hasConflicts = HgConflictResolver.hasConflicts(project, root);
if (!hasConflicts && HgErrorUtil.isCommandExecutionFailed(result)) {
new HgCommandResultNotifier(project).notifyError(result, "Hg Error", "Couldn't graft.");
return;
}
final UpdatedFiles updatedFiles = UpdatedFiles.create();
while (hasConflicts) {
new HgConflictResolver(project, updatedFiles).resolve(root);
hasConflicts = HgConflictResolver.hasConflicts(project, root);
if (!hasConflicts) {
result = command.continueGrafting();
hasConflicts = HgConflictResolver.hasConflicts(project, root);
} else {
new HgCommandResultNotifier(project).notifyError(result, "Hg Error", "Couldn't continue grafting");
break;
}
}
repository.update();
root.refresh(true, true);
}
use of com.intellij.openapi.vcs.update.UpdatedFiles in project intellij-community by JetBrains.
the class HgTaskHandler method mergeAndClose.
@Override
protected void mergeAndClose(@NotNull final String branch, @NotNull final List<HgRepository> repositories) {
String bookmarkRevisionArg = "bookmark(\"" + branch + "\")";
FileDocumentManager.getInstance().saveAllDocuments();
final UpdatedFiles updatedFiles = UpdatedFiles.create();
for (final HgRepository repository : repositories) {
HgMergeCommand.mergeWith(repository, bookmarkRevisionArg, updatedFiles, new Runnable() {
@Override
public void run() {
Project project = repository.getProject();
VirtualFile repositoryRoot = repository.getRoot();
try {
new HgCommitCommand(project, repository, "Automated merge with " + branch).executeInCurrentThread();
HgBookmarkCommand.deleteBookmarkSynchronously(project, repositoryRoot, branch);
} catch (HgCommandException e) {
HgErrorUtil.handleException(project, e);
} catch (VcsException e) {
VcsNotifier.getInstance(project).notifyError("Exception during merge commit with " + branch, e.getMessage());
}
}
});
}
}
use of com.intellij.openapi.vcs.update.UpdatedFiles in project intellij-community by JetBrains.
the class SvnNativeClientAuthTest method updateExpectAuthCanceled.
private void updateExpectAuthCanceled(File wc1, String expectedText) {
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(session.getExceptions().get(0).getMessage().contains(expectedText));
if (myIsSecure) {
++myExpectedCreds;
++myExpectedCert;
}
}
use of com.intellij.openapi.vcs.update.UpdatedFiles in project intellij-community by JetBrains.
the class GitPushOperation method prepareCombinedResult.
private GitPushResult prepareCombinedResult(final Map<GitRepository, GitPushRepoResult> allRoots, final Map<GitRepository, GitUpdateResult> updatedRoots, final Map<GitRepository, String> preUpdatePositions, Label beforeUpdateLabel, Label afterUpdateLabel) {
Map<GitRepository, GitPushRepoResult> results = ContainerUtil.newHashMap();
UpdatedFiles updatedFiles = UpdatedFiles.create();
for (Map.Entry<GitRepository, GitPushRepoResult> entry : allRoots.entrySet()) {
GitRepository repository = entry.getKey();
GitPushRepoResult simpleResult = entry.getValue();
GitUpdateResult updateResult = updatedRoots.get(repository);
if (updateResult == null) {
results.put(repository, simpleResult);
} else {
collectUpdatedFiles(updatedFiles, repository, preUpdatePositions.get(repository));
results.put(repository, GitPushRepoResult.addUpdateResult(simpleResult, updateResult));
}
}
return new GitPushResult(results, updatedFiles, beforeUpdateLabel, afterUpdateLabel);
}
use of com.intellij.openapi.vcs.update.UpdatedFiles in project intellij-community by JetBrains.
the class GitPushResultNotification method create.
@NotNull
static GitPushResultNotification create(@NotNull Project project, @NotNull GitPushResult pushResult, boolean multiRepoProject) {
GroupedPushResult grouped = GroupedPushResult.group(pushResult.getResults());
String title;
NotificationType type;
if (!grouped.errors.isEmpty()) {
if (!grouped.successful.isEmpty()) {
title = "Push partially failed";
} else {
title = "Push failed";
}
type = NotificationType.ERROR;
} else if (!grouped.rejected.isEmpty() || !grouped.customRejected.isEmpty()) {
if (!grouped.successful.isEmpty()) {
title = "Push partially rejected";
} else {
title = "Push rejected";
}
type = NotificationType.WARNING;
} else {
title = "Push successful";
type = NotificationType.INFORMATION;
}
String description = formDescription(pushResult.getResults(), multiRepoProject);
ViewUpdatedFilesNotificationListener listener = null;
UpdatedFiles updatedFiles = pushResult.getUpdatedFiles();
if (!updatedFiles.isEmpty()) {
description += "<br/>" + VIEW_FILES_UPDATED_DURING_THE_PUSH;
listener = new ViewUpdatedFilesNotificationListener(project, updatedFiles, pushResult.getBeforeUpdateLabel(), pushResult.getAfterUpdateLabel());
}
NotificationGroup group = type == NotificationType.INFORMATION ? VcsNotifier.NOTIFICATION_GROUP_ID : VcsNotifier.IMPORTANT_ERROR_NOTIFICATION;
return new GitPushResultNotification(group.getDisplayId(), title, description, type, listener);
}
Aggregations