Class DiscardPlan

java.lang.Object
io.github.jbastgen.stemma.app.git.DiscardPlan

public final class DiscardPlan extends Object
What discarding a selection of working-tree files means, and what to tell the user before doing it. A modified or deleted file returns to its state in HEAD; a new file that is staged is removed from the index and from the disk; a file that Git does not know yet (untracked) is deleted, which is the only thing Git cannot bring back; a file with an unresolved conflict is left for a separate question.
  • Method Details

    • isUntracked

      public static boolean isUntracked(FileChange f)
      Git does not know the file yet: a new file that is not staged.
    • of

      public static DiscardPlan of(List<FileChange> files)
      Sorts the files into the groups that are discarded differently: with conflicts, untracked, new and staged, and changed tracked files.
    • ordinary

      public List<FileChange> ordinary()
      The files that can be discarded after one confirmation: everything except the conflicted ones.
    • conflicted

      public List<FileChange> conflicted()
      The files with conflicts; they need their own confirmation, since discarding them abandons the resolution.
    • onlyUntracked

      public boolean onlyUntracked()
      Only untracked files: the action is a Delete, not a Discard.
    • actionLabel

      public String actionLabel()
      Menu entry and button text for this selection.
    • title

      public String title()
      The question of the confirmation dialog.
    • message

      public String message()
      The names (the first few) and what happens to them; always ends with what cannot be undone.
    • conflictTitle

      public String conflictTitle()
      The question of the second confirmation for files with conflicts.
    • conflictMessage

      public String conflictMessage()
      The warning for files with conflicts.
    • list

      public static String list(List<FileChange> files)
      One name per line, the first 6, then "… and N more".
    • done

      public static String done(int discarded, int deleted)
      The message after it was done.