Class TestRepository.CommitBuilder

java.lang.Object
org.eclipse.jgit.junit.TestRepository.CommitBuilder
Enclosing class:
TestRepository<R extends org.eclipse.jgit.lib.Repository>

public class TestRepository.CommitBuilder extends Object
Helper to generate a commit.
  • Method Details

    • parent

      public TestRepository<R>.CommitBuilder parent(@Nullable org.eclipse.jgit.revwalk.RevCommit p) throws Exception
      Set parent commit
      Parameters:
      p - parent commit, can be null
      Returns:
      this commit builder
      Throws:
      Exception - if an error occurred
    • parents

      public List<org.eclipse.jgit.revwalk.RevCommit> parents()
      Get parent commits
      Returns:
      parent commits
    • noParents

      public TestRepository<R>.CommitBuilder noParents()
      Remove parent commits
      Returns:
      this commit builder
    • noFiles

      public TestRepository<R>.CommitBuilder noFiles()
      Remove files
      Returns:
      this commit builder
    • setTopLevelTree

      public TestRepository<R>.CommitBuilder setTopLevelTree(org.eclipse.jgit.lib.ObjectId treeId)
      Set top level tree
      Parameters:
      treeId - the top level tree
      Returns:
      this commit builder
    • add

      public TestRepository<R>.CommitBuilder add(String path, String content) throws Exception
      Add file with given content
      Parameters:
      path - path of the file
      content - the file content
      Returns:
      this commit builder
      Throws:
      Exception - if an error occurred
    • add

      public TestRepository<R>.CommitBuilder add(String path, org.eclipse.jgit.revwalk.RevBlob id) throws Exception
      Add file with given path and blob
      Parameters:
      path - path of the file
      id - blob for this file
      Returns:
      this commit builder
      Throws:
      Exception - if an error occurred
    • edit

      public TestRepository<R>.CommitBuilder edit(org.eclipse.jgit.dircache.DirCacheEditor.PathEdit edit)
      Edit the index
      Parameters:
      edit - the index record update
      Returns:
      this commit builder
    • rm

      public TestRepository<R>.CommitBuilder rm(String path)
      Remove a file
      Parameters:
      path - path of the file
      Returns:
      this commit builder
    • message

      public TestRepository<R>.CommitBuilder message(String m)
      Set commit message
      Parameters:
      m - the message
      Returns:
      this commit builder
    • message

      public String message()
      Get the commit message
      Returns:
      the commit message
    • tick

      public TestRepository<R>.CommitBuilder tick(int secs)
      Tick the clock
      Parameters:
      secs - number of seconds
      Returns:
      this commit builder
    • ident

      public TestRepository<R>.CommitBuilder ident(org.eclipse.jgit.lib.PersonIdent ident)
      Set author and committer identity
      Parameters:
      ident - identity to set
      Returns:
      this commit builder
    • author

      public TestRepository<R>.CommitBuilder author(org.eclipse.jgit.lib.PersonIdent a)
      Set the author identity
      Parameters:
      a - the author's identity
      Returns:
      this commit builder
    • author

      public org.eclipse.jgit.lib.PersonIdent author()
      Get the author identity
      Returns:
      the author identity
    • committer

      public TestRepository<R>.CommitBuilder committer(org.eclipse.jgit.lib.PersonIdent c)
      Set the committer identity
      Parameters:
      c - the committer identity
      Returns:
      this commit builder
    • committer

      public org.eclipse.jgit.lib.PersonIdent committer()
      Get the committer identity
      Returns:
      the committer identity
    • insertChangeId

      public TestRepository<R>.CommitBuilder insertChangeId()
      Insert changeId
      Returns:
      this commit builder
    • insertChangeId

      public TestRepository<R>.CommitBuilder insertChangeId(String c)
      Insert given changeId
      Parameters:
      c - changeId
      Returns:
      this commit builder
    • create

      public org.eclipse.jgit.revwalk.RevCommit create() throws Exception
      Create the commit
      Returns:
      the new commit
      Throws:
      Exception - if creation failed
    • child

      public TestRepository<R>.CommitBuilder child() throws Exception
      Create child commit builder
      Returns:
      child commit builder
      Throws:
      Exception - if an error occurred