Class Sequencer

java.lang.Object
io.github.jbastgen.stemma.git.sequence.Sequencer

public final class Sequencer extends Object
Cherry-pick and revert of several commits, the same for both backends: a queue of commits that is applied one after the other through a SequenceEngine. When a commit conflicts, the state (what is left, how far it got, the message and author of the commit that stopped) is written to .git/stemma-sequence/state.properties, so it survives a restart of the application; continuing, skipping and aborting work from that file. Nothing here is specific to JGit or to the git command line.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Sequencer(io.github.jbastgen.stemma.git.api.GitRepository repo, SequenceEngine engine)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Gives up: the branch goes back to where it was before the series and the state is removed.
    io.github.jbastgen.stemma.git.api.SequenceKind
    What is in progress, from the state file; NONE when there is none or it cannot be read.
    io.github.jbastgen.stemma.git.api.SequenceResult
    Continues after the conflicts were resolved and staged: commits the step, then runs the rest.
    io.github.jbastgen.stemma.git.api.SequenceResult
    Leaves out the commit that stopped: its changes are thrown away, then the rest runs.
    io.github.jbastgen.stemma.git.api.SequenceResult
    start(io.github.jbastgen.stemma.git.api.SequenceKind kind, List<String> commits, boolean recordOrigin, boolean noCommit, int mainline)
    Starts a series of commits and runs it until it is done or stops on a conflict.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Sequencer

      public Sequencer(io.github.jbastgen.stemma.git.api.GitRepository repo, SequenceEngine engine)
      Parameters:
      repo - the repository to work on
      engine - the operations of the backend that apply and commit single steps
  • Method Details

    • inProgress

      public io.github.jbastgen.stemma.git.api.SequenceKind inProgress()
      What is in progress, from the state file; NONE when there is none or it cannot be read.
    • start

      public io.github.jbastgen.stemma.git.api.SequenceResult start(io.github.jbastgen.stemma.git.api.SequenceKind kind, List<String> commits, boolean recordOrigin, boolean noCommit, int mainline)
      Starts a series of commits and runs it until it is done or stops on a conflict.
      Parameters:
      commits - the commits in the order they are applied
      recordOrigin - add the line "(cherry picked from commit …)"
      noCommit - apply the one commit to the working tree only
      mainline - the parent whose side a merge commit is taken against; 0 for other commits
      Throws:
      io.github.jbastgen.stemma.git.api.GitException - if something else is in progress, the working tree is not clean or a commit cannot be used
    • next

      public io.github.jbastgen.stemma.git.api.SequenceResult next()
      Continues after the conflicts were resolved and staged: commits the step, then runs the rest.
    • skip

      public io.github.jbastgen.stemma.git.api.SequenceResult skip()
      Leaves out the commit that stopped: its changes are thrown away, then the rest runs.
    • abort

      public void abort()
      Gives up: the branch goes back to where it was before the series and the state is removed.