java.lang.Object
org.eclipse.jgit.junit.TestRepository.CommitBuilder
- Enclosing class:
- TestRepository<R extends org.eclipse.jgit.lib.Repository>
Helper to generate a commit.
-
Method Summary
Modifier and TypeMethodDescriptionAdd file with given contentAdd file with given path and bloborg.eclipse.jgit.lib.PersonIdentauthor()Get the author identityauthor(org.eclipse.jgit.lib.PersonIdent a) Set the author identitychild()Create child commit builderorg.eclipse.jgit.lib.PersonIdentGet the committer identitycommitter(org.eclipse.jgit.lib.PersonIdent c) Set the committer identityorg.eclipse.jgit.revwalk.RevCommitcreate()Create the commitedit(org.eclipse.jgit.dircache.DirCacheEditor.PathEdit edit) Edit the indexident(org.eclipse.jgit.lib.PersonIdent ident) Set author and committer identityInsert changeIdInsert given changeIdmessage()Get the commit messageSet commit messagenoFiles()Remove filesRemove parent commitsparent(org.eclipse.jgit.revwalk.RevCommit p) Set parent commitList<org.eclipse.jgit.revwalk.RevCommit>parents()Get parent commitsRemove a filesetTopLevelTree(org.eclipse.jgit.lib.ObjectId treeId) Set top level treetick(int secs) Tick the clock
-
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 benull- Returns:
- this commit builder
- Throws:
Exception- if an error occurred
-
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- 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 fileid- blob for this file- Returns:
- this commit builder
- Throws:
Exception- if an error occurred
-
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
public org.eclipse.jgit.lib.PersonIdent author()Get the author identity- Returns:
- the author identity
-
committer
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
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
-
child
Create child commit builder- Returns:
- child commit builder
- Throws:
Exception- if an error occurred
-