public class ChangeEditModifier
extends java.lang.Object
This class contains methods to modify edit's content. For retrieving, publishing and deleting
edit see ChangeEditUtil
.
Modifier and Type | Method and Description |
---|---|
ChangeEdit |
combineWithModifiedPatchSetTree(org.eclipse.jgit.lib.Repository repository,
ChangeNotes notes,
PatchSet patchSet,
java.util.List<TreeModification> treeModifications)
Applies the indicated modifications to the specified patch set.
|
void |
createEdit(org.eclipse.jgit.lib.Repository repository,
ChangeNotes notes)
Creates a new change edit.
|
void |
deleteFile(org.eclipse.jgit.lib.Repository repository,
ChangeNotes notes,
java.lang.String file)
Deletes a file from the Git tree of a change edit.
|
void |
modifyFile(org.eclipse.jgit.lib.Repository repository,
ChangeNotes notes,
java.lang.String filePath,
RawInput newContent)
Modifies the contents of a file of a change edit.
|
void |
modifyMessage(org.eclipse.jgit.lib.Repository repository,
ChangeNotes notes,
java.lang.String newCommitMessage)
Modifies the commit message of a change edit.
|
void |
rebaseEdit(org.eclipse.jgit.lib.Repository repository,
ChangeNotes notes)
Rebase change edit on latest patch set
|
void |
renameFile(org.eclipse.jgit.lib.Repository repository,
ChangeNotes notes,
java.lang.String currentFilePath,
java.lang.String newFilePath)
Renames a file of a change edit or moves it to another directory.
|
void |
restoreFile(org.eclipse.jgit.lib.Repository repository,
ChangeNotes notes,
java.lang.String file)
Restores a file of a change edit to the state it was in before the patch set on which the
change edit is based.
|
public void createEdit(org.eclipse.jgit.lib.Repository repository, ChangeNotes notes) throws AuthException, java.io.IOException, InvalidChangeOperationException, PermissionBackendException, ResourceConflictException
repository
- the affected Git repositorynotes
- the ChangeNotes
of the change for which the change edit should be createdAuthException
- if the user isn't authenticated or not allowed to use change editsInvalidChangeOperationException
- if a change edit already existed for the changePermissionBackendException
java.io.IOException
ResourceConflictException
public void rebaseEdit(org.eclipse.jgit.lib.Repository repository, ChangeNotes notes) throws AuthException, InvalidChangeOperationException, java.io.IOException, MergeConflictException, PermissionBackendException, ResourceConflictException
repository
- the affected Git repositorynotes
- the ChangeNotes
of the change whose change edit should be rebasedAuthException
- if the user isn't authenticated or not allowed to use change editsInvalidChangeOperationException
- if a change edit doesn't exist for the specified
change, the change edit is already based on the latest patch set, or the change represents
the root commitMergeConflictException
- if rebase fails due to merge conflictsPermissionBackendException
java.io.IOException
ResourceConflictException
public void modifyMessage(org.eclipse.jgit.lib.Repository repository, ChangeNotes notes, java.lang.String newCommitMessage) throws AuthException, java.io.IOException, UnchangedCommitMessageException, PermissionBackendException, BadRequestException, ResourceConflictException
repository
- the affected Git repositorynotes
- the ChangeNotes
of the change whose change edit's message should be
modifiednewCommitMessage
- the new commit messageAuthException
- if the user isn't authenticated or not allowed to use change editsUnchangedCommitMessageException
- if the commit message is the same as beforePermissionBackendException
BadRequestException
- if the commit message is malformedjava.io.IOException
ResourceConflictException
public void modifyFile(org.eclipse.jgit.lib.Repository repository, ChangeNotes notes, java.lang.String filePath, RawInput newContent) throws AuthException, BadRequestException, InvalidChangeOperationException, java.io.IOException, PermissionBackendException, ResourceConflictException
repository
- the affected Git repositorynotes
- the ChangeNotes
of the change whose change edit should be modifiedfilePath
- the path of the file whose contents should be modifiednewContent
- the new file contentAuthException
- if the user isn't authenticated or not allowed to use change editsBadRequestException
- if the user provided bad input (e.g. invalid file paths)InvalidChangeOperationException
- if the file already had the specified contentPermissionBackendException
ResourceConflictException
- if the project state does not permit the operationjava.io.IOException
public void deleteFile(org.eclipse.jgit.lib.Repository repository, ChangeNotes notes, java.lang.String file) throws AuthException, BadRequestException, InvalidChangeOperationException, java.io.IOException, PermissionBackendException, ResourceConflictException
repository
- the affected Git repositorynotes
- the ChangeNotes
of the change whose change edit should be modifiedfile
- path of the file which should be deletedAuthException
- if the user isn't authenticated or not allowed to use change editsBadRequestException
- if the user provided bad input (e.g. invalid file paths)InvalidChangeOperationException
- if the file does not existPermissionBackendException
ResourceConflictException
- if the project state does not permit the operationjava.io.IOException
public void renameFile(org.eclipse.jgit.lib.Repository repository, ChangeNotes notes, java.lang.String currentFilePath, java.lang.String newFilePath) throws AuthException, BadRequestException, InvalidChangeOperationException, java.io.IOException, PermissionBackendException, ResourceConflictException
repository
- the affected Git repositorynotes
- the ChangeNotes
of the change whose change edit should be modifiedcurrentFilePath
- the current path/name of the filenewFilePath
- the desired path/name of the fileAuthException
- if the user isn't authenticated or not allowed to use change editsBadRequestException
- if the user provided bad input (e.g. invalid file paths)InvalidChangeOperationException
- if the file was already renamed to the specified new
namePermissionBackendException
ResourceConflictException
- if the project state does not permit the operationjava.io.IOException
public void restoreFile(org.eclipse.jgit.lib.Repository repository, ChangeNotes notes, java.lang.String file) throws AuthException, BadRequestException, InvalidChangeOperationException, java.io.IOException, PermissionBackendException, ResourceConflictException
repository
- the affected Git repositorynotes
- the ChangeNotes
of the change whose change edit should be modifiedfile
- the path of the file which should be restoredAuthException
- if the user isn't authenticated or not allowed to use change editsInvalidChangeOperationException
- if the file was already restoredPermissionBackendException
BadRequestException
java.io.IOException
ResourceConflictException
public ChangeEdit combineWithModifiedPatchSetTree(org.eclipse.jgit.lib.Repository repository, ChangeNotes notes, PatchSet patchSet, java.util.List<TreeModification> treeModifications) throws AuthException, BadRequestException, java.io.IOException, InvalidChangeOperationException, MergeConflictException, PermissionBackendException, ResourceConflictException
repository
- the affected Git repositorynotes
- the ChangeNotes
of the change to which the patch set belongspatchSet
- the PatchSet
which should be modifiedtreeModifications
- the modifications which should be appliedChangeEdit
AuthException
- if the user isn't authenticated or not allowed to use change editsInvalidChangeOperationException
- if the existing change edit is based on another patch
set or no change edit exists but the specified patch set isn't the current oneMergeConflictException
- if the modified patch set tree can't be merged with an existing
change editBadRequestException
java.io.IOException
PermissionBackendException
ResourceConflictException