SourceControl¶
10 tools for revision control through the editor's provider (Perforce, Git...): the connection, file status and local changes, checkout, add, revert, submit and file history.
Back to the index.
add_files_to_source_control¶
Additive Idempotent
Mark new files for add in revision control, so the next submit includes them. The files must exist on disk: save a new asset first. A file already under revision control or already added counts as added. A file the provider ignores (.gitignore, .p4ignore) comes back in failed. Idempotent. Refuses while revision control is disabled, and refuses paths under a Read Only Content Root. Success means every file reads added or under revision control afterwards.
| Parameter | Type | Required | Description |
|---|---|---|---|
asset_paths |
array | no | Content paths of the assets (/Game/Maps/Main or /Game/Maps/Main.Main). This or files is required. |
files |
array | no | Disk paths of other files, absolute or relative to the project folder. This or asset_paths is required. |
Returns: { added: [string], failed: [{file, error}] }
cancel_source_control_submit¶
Destructive Idempotent
Ask the provider to cancel the submit that start_source_control_submit started, if it is still running and the provider can cancel it (Git cannot; a submit that already reached the server may complete anyway). Idempotent: with no submit running nothing happens. canceled true means the cancel was requested; confirm with get_source_control_submit_status.
No parameters.
Returns: { canceled: bool, was_running: bool, note?: string }
checkout_files¶
Destructive Idempotent
Check files out in revision control so they can be edited and saved, through the editor's provider. A file already checked out or added by you counts as checked out. A file checked out by someone else on an exclusive-checkout provider, one not at the latest revision, or one not under revision control comes back in failed with the reason (the other user's name included). With a provider that does not use checkout (Git), it changes nothing and answers provider_uses_checkout false. Idempotent. Refuses while revision control is disabled, and refuses paths under a Read Only Content Root. Success means every file reads checked out afterwards.
| Parameter | Type | Required | Description |
|---|---|---|---|
asset_paths |
array | no | Content paths of the assets (/Game/Maps/Main or /Game/Maps/Main.Main). This or files is required. |
files |
array | no | Disk paths of other files, absolute or relative to the project folder. This or asset_paths is required. |
Returns: { checked_out: [string], failed: [{file, error}], provider_uses_checkout: bool, note?: string }
get_source_control_file_status¶
Read-only
Read the revision-control state of files through the editor's provider (Perforce, Git...): whether each is under revision control, checked out (by you or by someone else, with their name), added, deleted, modified, at the latest revision, conflicted or ignored, and what can be done with it next. Name assets by content path or other files (.ini, .uproject, source) by disk path. With revision control disabled it answers enabled false and no rows, without an error.
| Parameter | Type | Required | Description |
|---|---|---|---|
asset_paths |
array | no | Content paths of the assets (/Game/Maps/Main or /Game/Maps/Main.Main). This or files is required. |
files |
array | no | Disk paths of other files, absolute or relative to the project folder. This or asset_paths is required. |
force_update |
boolean | no | Optional. Ask the provider again instead of reading its cache. Default true. |
Returns: { provider: string, enabled: bool, available: bool, files: [{file, asset_path?, status, source_controlled, checked_out, checked_out_by_other, other_user, added, deleted, modified, current, conflicted, ignored, can_checkout, can_checkin, can_add}], note?: string }
get_source_control_history¶
Read-only
Read the revision history of one file from revision control, newest first: revision, user, date, description and changelist of each. With revision control disabled it answers enabled false and no revisions, without an error.
| Parameter | Type | Required | Description |
|---|---|---|---|
asset_path |
string | no | Content path of the asset. This or file is required. |
file |
string | no | Disk path of another file, absolute or relative to the project folder. This or asset_path is required. |
max_results |
integer | no | Optional cap on the revisions returned. Default 20. |
Returns: { provider: string, enabled: bool, available: bool, file?: string, revisions: [{revision, user, date, description, changelist}], count: int, truncated?: bool, note?: string }
get_source_control_status¶
Read-only
Report the editor revision-control connection, read-only: provider name, whether revision control is enabled and the provider available, and its status_text. Says nothing about individual files or their checkout state, and never connects or changes settings.
No parameters.
Returns: { provider, enabled, available, status_text }
get_source_control_submit_status¶
Read-only
Poll the submit that start_source_control_submit started in this editor session: running or finished, whether it succeeded, the provider's message, the files submitted (read back from the provider) and those that were not. has_submit false when none was started this session.
No parameters.
Returns: { has_submit: bool, running?: bool, finished?: bool, success?: bool, message?: string, submitted?: [string], not_submitted?: [{file, error}], file_count?: int, elapsed_seconds?: number }
list_source_control_changes¶
Read-only
List the files under a content folder that have local changes in revision control: checked out, added, deleted, modified, conflicted, or new and not yet added. The provider is asked for the folder's state first. With revision control disabled it answers enabled false and no rows, without an error.
| Parameter | Type | Required | Description |
|---|---|---|---|
path |
string | no | Optional content folder. Default /Game. |
max_results |
integer | no | Optional cap on the rows returned. Default 500. |
Returns: { provider: string, enabled: bool, available: bool, path: string, files: [{file, asset_path?, status, source_controlled, checked_out, checked_out_by_other, other_user, added, deleted, modified, current, conflicted, ignored, can_checkout, can_checkin, can_add}], count: int, truncated: bool, note?: string }
revert_files¶
Destructive Refused during PIE
Revert files in revision control: local changes are discarded and the file goes back to the revision you have; a checkout is released and an add is undone (the file stays on disk, no longer added). The loaded packages among them are reloaded from disk, discarding their unsaved edits too, and their undo history no longer applies. A level loaded in the editor is refused: open another level first. Refuses while revision control is disabled, and refuses paths under a Read Only Content Root. Success means every file reads unchanged afterwards.
| Parameter | Type | Required | Description |
|---|---|---|---|
asset_paths |
array | no | Content paths of the assets (/Game/Maps/Main or /Game/Maps/Main.Main). This or files is required. |
files |
array | no | Disk paths of other files, absolute or relative to the project folder. This or asset_paths is required. |
reload |
boolean | no | Optional. Reload the loaded packages from disk after the revert. Default true; with false they keep what is in memory, which no longer matches the file. |
Returns: { reverted: [string], reloaded: [string], failed: [{file, error}], not_reloaded?: [string], note?: string }
start_source_control_submit¶
Destructive Open world Refused during PIE
Start submitting files to revision control with a description (a Perforce submit, a Git commit), asynchronously: the call returns once the provider has the job; poll get_source_control_submit_status for the outcome. Files must be saved: it refuses when any of them has unsaved changes in the editor, naming them, and never saves for you. New files must be added first with add_files_to_source_control. One submit at a time: while one runs, a second answers already_running true and starts nothing. Refuses while revision control is disabled, and refuses paths under a Read Only Content Root.
| Parameter | Type | Required | Description |
|---|---|---|---|
description |
string | yes | The changelist description or commit message. Required. |
asset_paths |
array | no | Content paths of the assets (/Game/Maps/Main or /Game/Maps/Main.Main). This or files is required. |
files |
array | no | Disk paths of other files, absolute or relative to the project folder. This or asset_paths is required. |
keep_checked_out |
boolean | no | Optional. Keep the files checked out after the submit, on providers that check out. Default false. |
Returns: { submit_started: bool, already_running: bool, file_count: int, note: string }