/** * Check if rebase is in progress, propose to resolve conflicts. * * @return true if rebase is in progress, which means that update can't continue. */ private boolean checkRebaseInProgress() { LOG.info("checkRebaseInProgress: checking if there is an unfinished rebase process..."); final GitRebaser rebaser = new GitRebaser(myProject, myGit, myProgressIndicator); final Collection<VirtualFile> rebasingRoots = rebaser.getRebasingRoots(); if (rebasingRoots.isEmpty()) { return false; } LOG.info("checkRebaseInProgress: roots with unfinished rebase: " + rebasingRoots); GitConflictResolver.Params params = new GitConflictResolver.Params(); params.setErrorNotificationTitle("Can't update"); params.setMergeDescription( "You have unfinished rebase process. These conflicts must be resolved before update."); params.setErrorNotificationAdditionalDescription( "Then you may <b>continue rebase</b>. <br/> You also may <b>abort rebase</b> to restore the original branch and stop rebasing."); params.setReverse(true); return !new GitConflictResolver(myProject, myGit, rebasingRoots, params) { @Override protected boolean proceedIfNothingToMerge() { return rebaser.continueRebase(rebasingRoots); } @Override protected boolean proceedAfterAllMerged() { return rebaser.continueRebase(rebasingRoots); } }.merge(); }
/** * Checks if there are unmerged files (which may still be possible even if rebase or merge have * finished) * * @return true if there are unmerged files at */ private boolean areUnmergedFiles() { LOG.info("areUnmergedFiles: checking if there are unmerged files..."); GitConflictResolver.Params params = new GitConflictResolver.Params(); params.setErrorNotificationTitle("Update was not started"); params.setMergeDescription( "Unmerged files detected. These conflicts must be resolved before update."); return !new GitMergeCommittingConflictResolver( myProject, myGit, myMerger, GitUtil.getRootsFromRepositories(myRepositories), params, false) .merge(); }
/** * Check if merge is in progress, propose to resolve conflicts. * * @return true if merge is in progress, which means that update can't continue. */ private boolean isMergeInProgress() { LOG.info("isMergeInProgress: checking if there is an unfinished merge process..."); final Collection<VirtualFile> mergingRoots = myMerger.getMergingRoots(); if (mergingRoots.isEmpty()) { return false; } LOG.info("isMergeInProgress: roots with unfinished merge: " + mergingRoots); GitConflictResolver.Params params = new GitConflictResolver.Params(); params.setErrorNotificationTitle("Can't update"); params.setMergeDescription( "You have unfinished merge. These conflicts must be resolved before update."); return !new GitMergeCommittingConflictResolver( myProject, myGit, myMerger, mergingRoots, params, false) .merge(); }