Class MergeSession

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

public final class MergeSession extends Object
The state of resolving one conflicting file: the merged chunks and what the user chose for each conflict. Pure logic; the merge tool's window only displays it.
  • Constructor Details

    • MergeSession

      public MergeSession(String base, String ours, String theirs, String oursLabel, String theirsLabel, Charset charset)
      Parameters:
      base - the common ancestor
      ours - the branch that is checked out
      theirs - the branch that is merged
      oursLabel - the name of "ours" in the conflict markers
      theirsLabel - the name of "theirs" in the conflict markers
      charset - how the bytes of the file are read and written again
  • Method Details

    • chunks

      public List<Diff3.Chunk> chunks()
      The merged file in pieces: stable runs, merged changes and conflicts.
    • conflicts

      public int conflicts()
      How many conflicts there are.
    • unresolved

      public int unresolved()
      How many conflicts have no choice yet.
    • choice

      public MergeSession.Choice choice(int conflictIndex)
      The choice for a conflict; conflictIndex counts the conflicts only, from 0.
    • choose

      public void choose(int conflictIndex, MergeSession.Choice choice)
      Decides one conflict.
    • chooseAll

      public void chooseAll(MergeSession.Choice choice)
      Decides all conflicts the same way.
    • setAi

      public void setAi(int conflictIndex, AiMerge.Proposal proposal)
      Takes a proposal of the AI for a conflict; the sides stay one click away (any other choice replaces it).
    • ai

      public AiMerge.Proposal ai(int conflictIndex)
      The proposal of the AI for a conflict.
    • clearAi

      public void clearAi()
      Takes back every proposal of the AI: those conflicts are open again.
    • aiCount

      public int aiCount()
      How many conflicts are to be taken from the AI proposal.
    • result

      public String result()
      The merged text; conflicts that are not resolved yet appear with conflict markers.
    • hasMarkers

      public static boolean hasMarkers(String text)
      Whether text still contains conflict markers at the start of a line.