Interface ChangeEditApi
-
- All Known Implementing Classes:
ChangeEditApi.NotImplemented
public interface ChangeEditApi
An API for the change edit of a change. A change edit is similar to a patch set and will become one if it is published (bypublish(PublishChangeEditInput)
). Whenever the descriptions below refer to files of a change edit, they actually refer to the files of the Git tree which is represented by the change edit. A change can have at most one change edit at each point in time.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ChangeEditApi.ChangeEditDetailRequest
static class
ChangeEditApi.NotImplemented
A default implementation which allows source compatibility when adding new methods to the interface.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
create()
Creates a new change edit.void
delete()
Deletes the change edit.void
deleteFile(String filePath)
Deletes the specified file from the change edit.ChangeEditApi.ChangeEditDetailRequest
detail()
Optional<EditInfo>
get()
Retrieves details regarding the change edit.String
getCommitMessage()
Retrieves the commit message of the change edit.Optional<BinaryResult>
getFile(String filePath)
Retrieves the contents of the specified file from the change edit.void
modifyCommitMessage(String newCommitMessage)
Modifies the commit message of the change edit.void
modifyFile(String filePath, FileContentInput input)
Modify the contents of the specified file of the change edit.default void
modifyFile(String filePath, RawInput newContent)
Modify the contents of the specified file of the change edit.void
publish()
Publishes the change edit using default settings.void
publish(PublishChangeEditInput publishChangeEditInput)
Publishes the change edit.void
rebase()
Rebases the change edit on top of the latest patch set of this change.void
renameFile(String oldFilePath, String newFilePath)
Renames a file of the change edit or moves the file to another directory.void
restoreFile(String filePath)
Restores a file of the change edit to the state in which it was before the patch set on which the change edit is based.
-
-
-
Method Detail
-
detail
ChangeEditApi.ChangeEditDetailRequest detail() throws RestApiException
- Throws:
RestApiException
-
get
Optional<EditInfo> get() throws RestApiException
Retrieves details regarding the change edit.- Returns:
- an
Optional
containing details about the change edit if it exists, orOptional.empty()
- Throws:
RestApiException
- if the change edit couldn't be retrieved
-
create
void create() throws RestApiException
Creates a new change edit. It has exactly the same Git tree as the current patch set of the change.- Throws:
RestApiException
- if the change edit couldn't be created or a change edit already exists
-
delete
void delete() throws RestApiException
Deletes the change edit.- Throws:
RestApiException
- if the change edit couldn't be deleted or a change edit wasn't present
-
rebase
void rebase() throws RestApiException
Rebases the change edit on top of the latest patch set of this change.- Throws:
RestApiException
- if the change edit couldn't be rebased or a change edit wasn't present
-
publish
void publish() throws RestApiException
Publishes the change edit using default settings. Seepublish(PublishChangeEditInput)
for more details.- Throws:
RestApiException
- if the change edit couldn't be published or a change edit wasn't present
-
publish
void publish(PublishChangeEditInput publishChangeEditInput) throws RestApiException
Publishes the change edit. Publishing means that the change edit is turned into a regular patch set of the change.- Parameters:
publishChangeEditInput
- aPublishChangeEditInput
specifying the options which should be applied- Throws:
RestApiException
- if the change edit couldn't be published or a change edit wasn't present
-
getFile
Optional<BinaryResult> getFile(String filePath) throws RestApiException
Retrieves the contents of the specified file from the change edit.- Parameters:
filePath
- the path of the file- Returns:
- an
Optional
containing the contents of the file as aBinaryResult
if the file exists within the change edit, orOptional.empty()
- Throws:
RestApiException
- if the contents of the file couldn't be retrieved or a change edit wasn't present
-
renameFile
void renameFile(String oldFilePath, String newFilePath) throws RestApiException
Renames a file of the change edit or moves the file to another directory. If the change edit doesn't exist, it will be created based on the current patch set of the change.- Parameters:
oldFilePath
- the current file pathnewFilePath
- the desired file path- Throws:
RestApiException
- if the file couldn't be renamed
-
restoreFile
void restoreFile(String filePath) throws RestApiException
Restores a file of the change edit to the state in which it was before the patch set on which the change edit is based. This includes the file content as well as the existence or non-existence of the file. If the change edit doesn't exist, it will be created based on the current patch set of the change.- Parameters:
filePath
- the path of the file- Throws:
RestApiException
- if the file couldn't be restored to its previous state
-
modifyFile
default void modifyFile(String filePath, RawInput newContent) throws RestApiException
Modify the contents of the specified file of the change edit. If no content is provided, the content of the file is erased but the file isn't deleted. If the change edit doesn't exist, it will be created based on the current patch set of the change.- Parameters:
filePath
- the path of the file which should be modifiednewContent
- the desired content of the file- Throws:
RestApiException
- if the content of the file couldn't be modified
-
modifyFile
void modifyFile(String filePath, FileContentInput input) throws RestApiException
Modify the contents of the specified file of the change edit. If no content is provided, the content of the file is erased but the file isn't deleted. If the change edit doesn't exist, it will be created based on the current patch set of the change.- Parameters:
filePath
- the path of the file which should be modifiedinput
- the desired content of the file- Throws:
RestApiException
- if the content of the file couldn't be modified
-
deleteFile
void deleteFile(String filePath) throws RestApiException
Deletes the specified file from the change edit. If the change edit doesn't exist, it will be created based on the current patch set of the change.- Parameters:
filePath
- the path fo the file which should be deleted- Throws:
RestApiException
- if the file couldn't be deleted
-
getCommitMessage
String getCommitMessage() throws RestApiException
Retrieves the commit message of the change edit.- Returns:
- the commit message of the change edit
- Throws:
RestApiException
- if the commit message couldn't be retrieved or a change edit wasn't present
-
modifyCommitMessage
void modifyCommitMessage(String newCommitMessage) throws RestApiException
Modifies the commit message of the change edit. If the change edit doesn't exist, it will be created based on the current patch set of the change.- Parameters:
newCommitMessage
- the desired commit message- Throws:
RestApiException
- if the commit message couldn't be modified
-
-