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.Object
Helper to generate a commit.
-
-
Field Summary
Fields Modifier and Type Field Description private PersonIdent
author
private TestRepository.BranchBuilder
branch
private java.lang.String
changeId
private PersonIdent
committer
private java.lang.String
message
private java.util.List<RevCommit>
parents
private RevCommit
self
private int
tick
private ObjectId
topLevelTree
private DirCache
tree
private boolean
updateCommitterTime
-
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.CommitBuilder
add(java.lang.String path, java.lang.String content)
Add file with given contentTestRepository.CommitBuilder
add(java.lang.String path, RevBlob id)
Add file with given path and blobPersonIdent
author()
Get the author identityTestRepository.CommitBuilder
author(PersonIdent a)
Set the author identityTestRepository.CommitBuilder
child()
Create child commit builderPersonIdent
committer()
Get the committer identityTestRepository.CommitBuilder
committer(PersonIdent c)
Set the committer identityRevCommit
create()
Create the commitTestRepository.CommitBuilder
edit(DirCacheEditor.PathEdit edit)
Edit the indexTestRepository.CommitBuilder
ident(PersonIdent ident)
Set author and committer identityTestRepository.CommitBuilder
insertChangeId()
Insert changeIdTestRepository.CommitBuilder
insertChangeId(java.lang.String c)
Insert given changeIdprivate void
insertChangeId(CommitBuilder c)
java.lang.String
message()
Get the commit messageTestRepository.CommitBuilder
message(java.lang.String m)
Set commit messageTestRepository.CommitBuilder
noFiles()
Remove filesTestRepository.CommitBuilder
noParents()
Remove parent commitsTestRepository.CommitBuilder
parent(RevCommit p)
set parent commitjava.util.List<RevCommit>
parents()
Get parent commitsTestRepository.CommitBuilder
rm(java.lang.String path)
Remove a fileTestRepository.CommitBuilder
setTopLevelTree(ObjectId treeId)
Set top level treeTestRepository.CommitBuilder
tick(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
-
-