Class RebaseTodoFile


  • public class RebaseTodoFile
    extends java.lang.Object
    Offers methods to read and write files formatted like the git-rebase-todo file
    Since:
    3.2
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Repository repo  
    • Constructor Summary

      Constructors 
      Constructor Description
      RebaseTodoFile​(Repository repo)
      Constructor for RebaseTodoFile.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static int nextParsableToken​(byte[] buf, int tokenBegin, int lineEnd)
      Skip leading space, tab, CR and LF characters
      private static void parseComments​(byte[] buf, int tokenBegin, java.util.List<RebaseTodoLine> r, int lineEnd)  
      private static RebaseTodoLine parseLine​(byte[] buf, int tokenBegin, int lineEnd)  
      java.util.List<RebaseTodoLine> readRebaseTodo​(java.lang.String path, boolean includeComments)
      Read a file formatted like the git-rebase-todo file.
      void writeRebaseTodoFile​(java.lang.String path, java.util.List<RebaseTodoLine> steps, boolean append)
      Write a file formatted like a git-rebase-todo file.
      • Methods inherited from class java.lang.Object

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

      • RebaseTodoFile

        public RebaseTodoFile​(Repository repo)
        Constructor for RebaseTodoFile.
        Parameters:
        repo - a Repository object.
    • Method Detail

      • readRebaseTodo

        public java.util.List<RebaseTodoLine> readRebaseTodo​(java.lang.String path,
                                                             boolean includeComments)
                                                      throws java.io.IOException
        Read a file formatted like the git-rebase-todo file. The "done" file is also formatted like the git-rebase-todo file. These files can be found in .git/rebase-merge/ or .git/rebase-append/ folders.
        Parameters:
        path - path to the file relative to the repository's git-dir. E.g. "rebase-merge/git-rebase-todo" or "rebase-append/done"
        includeComments - true if also comments should be reported
        Returns:
        the list of steps
        Throws:
        java.io.IOException
      • parseComments

        private static void parseComments​(byte[] buf,
                                          int tokenBegin,
                                          java.util.List<RebaseTodoLine> r,
                                          int lineEnd)
      • nextParsableToken

        private static int nextParsableToken​(byte[] buf,
                                             int tokenBegin,
                                             int lineEnd)
        Skip leading space, tab, CR and LF characters
        Parameters:
        buf -
        tokenBegin -
        lineEnd -
        Returns:
        the token within the range of the given buf that doesn't need to be skipped, -1 if no such token found within the range (i.e. empty line)
      • parseLine

        private static RebaseTodoLine parseLine​(byte[] buf,
                                                int tokenBegin,
                                                int lineEnd)
      • writeRebaseTodoFile

        public void writeRebaseTodoFile​(java.lang.String path,
                                        java.util.List<RebaseTodoLine> steps,
                                        boolean append)
                                 throws java.io.IOException
        Write a file formatted like a git-rebase-todo file.
        Parameters:
        path - path to the file relative to the repository's git-dir. E.g. "rebase-merge/git-rebase-todo" or "rebase-append/done"
        steps - the steps to be written
        append - whether to append to an existing file or to write a new file
        Throws:
        java.io.IOException