Package org.eclipse.jgit.junit
Class TestRepository.CommitBuilder
java.lang.Object
org.eclipse.jgit.junit.TestRepository.CommitBuilder
- Enclosing class:
TestRepository<R extends Repository>
Helper to generate a commit.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PersonIdent
private final TestRepository<R>.BranchBuilder
private String
private PersonIdent
private String
private RevCommit
private int
private ObjectId
private final DirCache
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd file with given contentAdd file with given path and blobauthor()
Get the author identitySet the author identitychild()
Create child commit builderGet the committer identitySet the committer identitycreate()
Create the commitedit
(DirCacheEditor.PathEdit edit) Edit the indexident
(PersonIdent ident) Set author and committer identityInsert changeIdInsert given changeIdprivate void
message()
Get the commit messageSet commit messagenoFiles()
Remove filesRemove parent commitsset parent commitparents()
Get parent commitsRemove a filesetTopLevelTree
(ObjectId treeId) Set top level treetick
(int secs) Tick the clock
-
Field Details
-
branch
-
tree
-
topLevelTree
-
parents
-
tick
private int tick -
message
-
self
-
author
-
committer
-
changeId
-
updateCommitterTime
private boolean updateCommitterTime
-
-
Constructor Details
-
CommitBuilder
CommitBuilder() -
CommitBuilder
CommitBuilder(TestRepository<R>.BranchBuilder b) throws Exception - Throws:
Exception
-
CommitBuilder
CommitBuilder(TestRepository<R>.CommitBuilder prior) throws Exception - Throws:
Exception
-
-
Method Details
-
parent
set parent commit- Parameters:
p
- parent commit- Returns:
- this commit builder
- Throws:
Exception
-
parents
Get parent commits- Returns:
- parent commits
-
noParents
Remove parent commits- Returns:
- this commit builder
-
noFiles
Remove files- Returns:
- this commit builder
-
setTopLevelTree
Set top level tree- Parameters:
treeId
- the top level tree- Returns:
- this commit builder
-
add
Add file with given content- Parameters:
path
- path of the filecontent
- the file content- Returns:
- this commit builder
- Throws:
Exception
-
add
Add file with given path and blob- Parameters:
path
- path of the fileid
- blob for this file- Returns:
- this commit builder
- Throws:
Exception
-
edit
Edit the index- Parameters:
edit
- the index record update- Returns:
- this commit builder
-
rm
Remove a file- Parameters:
path
- path of the file- Returns:
- this commit builder
-
message
Set commit message- Parameters:
m
- the message- Returns:
- this commit builder
-
message
Get the commit message- Returns:
- the commit message
-
tick
Tick the clock- Parameters:
secs
- number of seconds- Returns:
- this commit builder
-
ident
Set author and committer identity- Parameters:
ident
- identity to set- Returns:
- this commit builder
-
author
Set the author identity- Parameters:
a
- the author's identity- Returns:
- this commit builder
-
author
Get the author identity- Returns:
- the author identity
-
committer
Set the committer identity- Parameters:
c
- the committer identity- Returns:
- this commit builder
-
committer
Get the committer identity- Returns:
- the committer identity
-
insertChangeId
Insert changeId- Returns:
- this commit builder
-
insertChangeId
Insert given changeId- Parameters:
c
- changeId- Returns:
- this commit builder
-
create
Create the commit- Returns:
- the new commit
- Throws:
Exception
- if creation failed
-
insertChangeId
-
child
Create child commit builder- Returns:
- child commit builder
- Throws:
Exception
-