Package org.eclipse.jgit.junit
Class TestRepository.CommitBuilder
- java.lang.Object
-
- org.eclipse.jgit.junit.TestRepository.CommitBuilder
-
- Enclosing class:
- TestRepository<R extends Repository>
public class TestRepository.CommitBuilder extends java.lang.ObjectHelper to generate a commit.
-
-
Field Summary
Fields Modifier and Type Field Description private PersonIdentauthorprivate TestRepository.BranchBuilderbranchprivate java.lang.StringchangeIdprivate PersonIdentcommitterprivate java.lang.Stringmessageprivate java.util.List<RevCommit>parentsprivate RevCommitselfprivate inttickprivate ObjectIdtopLevelTreeprivate DirCachetreeprivate booleanupdateCommitterTime
-
Constructor Summary
Constructors Constructor Description CommitBuilder()CommitBuilder(TestRepository.BranchBuilder b)CommitBuilder(TestRepository.CommitBuilder prior)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TestRepository.CommitBuilderadd(java.lang.String path, java.lang.String content)Add file with given contentTestRepository.CommitBuilderadd(java.lang.String path, RevBlob id)Add file with given path and blobPersonIdentauthor()Get the author identityTestRepository.CommitBuilderauthor(PersonIdent a)Set the author identityTestRepository.CommitBuilderchild()Create child commit builderPersonIdentcommitter()Get the committer identityTestRepository.CommitBuildercommitter(PersonIdent c)Set the committer identityRevCommitcreate()Create the commitTestRepository.CommitBuilderedit(DirCacheEditor.PathEdit edit)Edit the indexTestRepository.CommitBuilderident(PersonIdent ident)Set author and committer identityTestRepository.CommitBuilderinsertChangeId()Insert changeIdTestRepository.CommitBuilderinsertChangeId(java.lang.String c)Insert given changeIdprivate voidinsertChangeId(CommitBuilder c)java.lang.Stringmessage()Get the commit messageTestRepository.CommitBuildermessage(java.lang.String m)Set commit messageTestRepository.CommitBuildernoFiles()Remove filesTestRepository.CommitBuildernoParents()Remove parent commitsTestRepository.CommitBuilderparent(RevCommit p)set parent commitjava.util.List<RevCommit>parents()Get parent commitsTestRepository.CommitBuilderrm(java.lang.String path)Remove a fileTestRepository.CommitBuildersetTopLevelTree(ObjectId treeId)Set top level treeTestRepository.CommitBuildertick(int secs)Tick the clock
-
-
-
Field Detail
-
branch
private final TestRepository.BranchBuilder branch
-
tree
private final DirCache tree
-
topLevelTree
private ObjectId topLevelTree
-
parents
private final java.util.List<RevCommit> parents
-
tick
private int tick
-
message
private java.lang.String message
-
self
private RevCommit self
-
author
private PersonIdent author
-
committer
private PersonIdent committer
-
changeId
private java.lang.String changeId
-
updateCommitterTime
private boolean updateCommitterTime
-
-
Constructor Detail
-
CommitBuilder
CommitBuilder()
-
CommitBuilder
CommitBuilder(TestRepository.BranchBuilder b) throws java.lang.Exception
- Throws:
java.lang.Exception
-
CommitBuilder
CommitBuilder(TestRepository.CommitBuilder prior) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-
Method Detail
-
parent
public TestRepository.CommitBuilder parent(RevCommit p) throws java.lang.Exception
set parent commit- Parameters:
p- parent commit- Returns:
- this commit builder
- Throws:
java.lang.Exception
-
parents
public java.util.List<RevCommit> parents()
Get parent commits- Returns:
- parent commits
-
noParents
public TestRepository.CommitBuilder noParents()
Remove parent commits- Returns:
- this commit builder
-
noFiles
public TestRepository.CommitBuilder noFiles()
Remove files- Returns:
- this commit builder
-
setTopLevelTree
public TestRepository.CommitBuilder setTopLevelTree(ObjectId treeId)
Set top level tree- Parameters:
treeId- the top level tree- Returns:
- this commit builder
-
add
public TestRepository.CommitBuilder add(java.lang.String path, java.lang.String content) throws java.lang.Exception
Add file with given content- Parameters:
path- path of the filecontent- the file content- Returns:
- this commit builder
- Throws:
java.lang.Exception
-
add
public TestRepository.CommitBuilder add(java.lang.String path, RevBlob id) throws java.lang.Exception
Add file with given path and blob- Parameters:
path- path of the fileid- blob for this file- Returns:
- this commit builder
- Throws:
java.lang.Exception
-
edit
public TestRepository.CommitBuilder edit(DirCacheEditor.PathEdit edit)
Edit the index- Parameters:
edit- the index record update- Returns:
- this commit builder
-
rm
public TestRepository.CommitBuilder rm(java.lang.String path)
Remove a file- Parameters:
path- path of the file- Returns:
- this commit builder
-
message
public TestRepository.CommitBuilder message(java.lang.String m)
Set commit message- Parameters:
m- the message- Returns:
- this commit builder
-
message
public java.lang.String message()
Get the commit message- Returns:
- the commit message
-
tick
public TestRepository.CommitBuilder tick(int secs)
Tick the clock- Parameters:
secs- number of seconds- Returns:
- this commit builder
-
ident
public TestRepository.CommitBuilder ident(PersonIdent ident)
Set author and committer identity- Parameters:
ident- identity to set- Returns:
- this commit builder
-
author
public TestRepository.CommitBuilder author(PersonIdent a)
Set the author identity- Parameters:
a- the author's identity- Returns:
- this commit builder
-
author
public PersonIdent author()
Get the author identity- Returns:
- the author identity
-
committer
public TestRepository.CommitBuilder committer(PersonIdent c)
Set the committer identity- Parameters:
c- the committer identity- Returns:
- this commit builder
-
committer
public PersonIdent committer()
Get the committer identity- Returns:
- the committer identity
-
insertChangeId
public TestRepository.CommitBuilder insertChangeId()
Insert changeId- Returns:
- this commit builder
-
insertChangeId
public TestRepository.CommitBuilder insertChangeId(java.lang.String c)
Insert given changeId- Parameters:
c- changeId- Returns:
- this commit builder
-
create
public RevCommit create() throws java.lang.Exception
Create the commit- Returns:
- the new commit
- Throws:
java.lang.Exception- if creation failed
-
insertChangeId
private void insertChangeId(CommitBuilder c)
-
child
public TestRepository.CommitBuilder child() throws java.lang.Exception
Create child commit builder- Returns:
- child commit builder
- Throws:
java.lang.Exception
-
-