private GitUpdateResult handleRebaseFailure( GitLineHandler pullHandler, GitRebaseProblemDetector rebaseConflictDetector, final GitMessageWithFilesDetector untrackedWouldBeOverwrittenDetector) { if (rebaseConflictDetector.isMergeConflict()) { LOG.info("handleRebaseFailure merge conflict"); final boolean allMerged = new MyConflictResolver(myProject, myGit, myRoot, myRebaser).merge(); return allMerged ? GitUpdateResult.SUCCESS_WITH_RESOLVED_CONFLICTS : GitUpdateResult.INCOMPLETE; } else if (untrackedWouldBeOverwrittenDetector.wasMessageDetected()) { LOG.info("handleRebaseFailure: untracked files would be overwritten by checkout"); UntrackedFilesNotifier.notifyUntrackedFilesOverwrittenBy( myProject, ServiceManager.getService(myProject, GitPlatformFacade.class), untrackedWouldBeOverwrittenDetector.getFiles(), "rebase", null); return GitUpdateResult.ERROR; } else { LOG.info("handleRebaseFailure error " + pullHandler.errors()); GitUIUtil.notifyImportantError( myProject, "Rebase error", GitUIUtil.stringifyErrors(pullHandler.errors())); return GitUpdateResult.ERROR; } }
private static boolean createEmptyGitRepository( @NotNull Project project, @NotNull VirtualFile root, @NotNull ProgressIndicator indicator) { final GitLineHandler h = new GitLineHandler(project, root, GitCommand.INIT); GitHandlerUtil.runInCurrentThread( h, indicator, true, GitBundle.getString("initializing.title")); if (!h.errors().isEmpty()) { GitUIUtil.showOperationErrors(project, h.errors(), "git init"); LOG.info("Failed to create empty git repo: " + h.errors()); return false; } GitInit.refreshAndConfigureVcsMappings(project, root, root.getPath()); return true; }
@Override protected void doOKAction() { VirtualFile root = getGitRoot(); GitLineHandler h = handler(); final AtomicBoolean conflict = new AtomicBoolean(); h.addLineListener( new GitLineHandlerAdapter() { public void onLineAvailable(String line, Key outputType) { if (line.contains("Merge conflict")) { conflict.set(true); } } }); int rc = GitHandlerUtil.doSynchronously( h, GitBundle.getString("unstash.unstashing"), h.printableCommandLine(), false); root.refresh(true, true); if (conflict.get()) { boolean conflictsResolved = new UnstashConflictResolver(myProject, root, getSelectedStash()).merge(); LOG.info("loadRoot " + root + ", conflictsResolved: " + conflictsResolved); } else if (rc != 0) { GitUIUtil.showOperationErrors(myProject, h.errors(), h.printableCommandLine()); } super.doOKAction(); }