Search in sources :

Example 1 with GitChangesSaver

use of git4idea.stash.GitChangesSaver in project intellij-community by JetBrains.

the class GitPreservingProcess method configureSaver.

/**
   * Configures the saver: i.e. notifications and texts for the GitConflictResolver used inside.
   */
@NotNull
private GitChangesSaver configureSaver(@NotNull GitVcsSettings.UpdateChangesPolicy saveMethod) {
    GitChangesSaver saver = GitChangesSaver.getSaver(myProject, myGit, myProgressIndicator, myStashMessage, saveMethod);
    MergeDialogCustomizer mergeDialogCustomizer = new MergeDialogCustomizer() {

        @Override
        public String getMultipleFileMergeDescription(@NotNull Collection<VirtualFile> files) {
            return String.format("<html>Uncommitted changes that were saved before %s have conflicts with files from <code>%s</code></html>", myOperationTitle, myDestinationName);
        }

        @Override
        public String getLeftPanelTitle(@NotNull VirtualFile file) {
            return "Uncommitted changes from stash";
        }

        @Override
        public String getRightPanelTitle(@NotNull VirtualFile file, VcsRevisionNumber revisionNumber) {
            return String.format("<html>Changes from <b><code>%s</code></b></html>", myDestinationName);
        }
    };
    GitConflictResolver.Params params = new GitConflictResolver.Params().setReverse(true).setMergeDialogCustomizer(mergeDialogCustomizer).setErrorNotificationTitle("Local changes were not restored");
    saver.setConflictResolverParams(params);
    return saver;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) MergeDialogCustomizer(com.intellij.openapi.vcs.merge.MergeDialogCustomizer) GitConflictResolver(git4idea.merge.GitConflictResolver) VcsRevisionNumber(com.intellij.openapi.vcs.history.VcsRevisionNumber) Collection(java.util.Collection) GitChangesSaver(git4idea.stash.GitChangesSaver) NotNull(org.jetbrains.annotations.NotNull) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

VcsRevisionNumber (com.intellij.openapi.vcs.history.VcsRevisionNumber)1 MergeDialogCustomizer (com.intellij.openapi.vcs.merge.MergeDialogCustomizer)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 GitConflictResolver (git4idea.merge.GitConflictResolver)1 GitChangesSaver (git4idea.stash.GitChangesSaver)1 Collection (java.util.Collection)1 NotNull (org.jetbrains.annotations.NotNull)1