editor.sourcecontrol

Source control integration -- query file status, check out, check in, revert, get history, diff, sync, and list changelists through the editor's configured source control provider.

← API Reference

editor.sourcecontrol.getStatus

Get the source control status of one or more files.

Name Type Required Description
filesarray<string>YesPackage paths (e.g. /Game/Maps/MyMap) or disk file paths

Returns

Field Type Description
providerstringName of the active source control provider
filesarray<object>Status for each file
files[].filenamestringOn-disk filename
files[].display_namestringHuman-readable status name
files[].is_source_controlledbooleanWhether the file is under source control
files[].is_checked_outbooleanChecked out by current user
files[].is_currentbooleanUp to date with depot
files[].is_addedbooleanMarked for add
files[].is_deletedbooleanMarked for delete
files[].is_modifiedbooleanLocally modified
files[].is_conflictedbooleanIn conflict state
files[].is_ignoredbooleanIgnored by source control
files[].can_check_inbooleanCan be checked in
files[].can_check_outbooleanCan be checked out
files[].can_editbooleanCan be edited
files[].can_revertbooleanCan be reverted
files[].checked_out_bystring(optional) User who has the file checked out

Example Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "editor.sourcecontrol.getStatus",
  "params": {
    "files": ["/Game/Maps/MainLevel"]
  }
}

editor.sourcecontrol.checkOut

Check out file(s) for editing from source control.

Name Type Required Description
filesarray<string>YesPackage paths or disk file paths to check out

Returns

Field Type Description
successbooleanWhether the checkout succeeded
file_countnumberNumber of files processed
errorstring(optional) Error message if checkout failed

Example Request

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "editor.sourcecontrol.checkOut",
  "params": {
    "files": ["/Game/Maps/MainLevel"]
  }
}

editor.sourcecontrol.checkIn

Check in (submit) file(s) to source control with a description.

Name Type Required Description
filesarray<string>YesPackage paths or disk file paths to check in
descriptionstringYesChangelist/commit description
keep_checked_outbooleanNoKeep files checked out after submission (default: false)

Returns

Field Type Description
successbooleanWhether the check-in succeeded
file_countnumberNumber of files processed
messagestring(optional) Success message with changelist/revision info
errorstring(optional) Error message if check-in failed

Example Request

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "editor.sourcecontrol.checkIn",
  "params": {
    "files": ["/Game/Maps/MainLevel"],
    "description": "Updated lighting in main level"
  }
}

editor.sourcecontrol.revert

Revert file(s) to their source control depot version, discarding local changes.

Name Type Required Description
filesarray<string>YesPackage paths or disk file paths to revert
soft_revertbooleanNoIf true, keep local changes but remove checkout status (default: false)

Returns

Field Type Description
successbooleanWhether the revert succeeded
file_countnumberNumber of files processed
errorstring(optional) Error message if revert failed

Example Request

{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "editor.sourcecontrol.revert",
  "params": {
    "files": ["/Game/Maps/MainLevel"]
  }
}

editor.sourcecontrol.getHistory

Get the revision history for a file from source control.

Name Type Required Description
filestringYesPackage path or disk file path
max_revisionsnumberNoMaximum number of revisions to return (default: 50)

Returns

Field Type Description
filenamestringOn-disk filename
total_revisionsnumberTotal number of revisions available
historyarray<object>Revision history entries
history[].revisionstringRevision identifier string
history[].revision_numbernumberNumeric revision number
history[].descriptionstringChangelist/commit description
history[].userstringUser who submitted the revision
history[].actionstringAction taken (edit, add, branch, integrate, etc.)
history[].datestringDate of the revision
history[].changelistnumberChangelist/check-in identifier
history[].file_sizenumberFile size at this revision (0 if deleted)

Example Request

{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "editor.sourcecontrol.getHistory",
  "params": {
    "file": "/Game/Maps/MainLevel",
    "max_revisions": 10
  }
}

editor.sourcecontrol.diff

Get diff information between the local file and the depot/repository version. Returns paths to the local and depot versions for comparison.

Name Type Required Description
filestringYesPackage path or disk file path

Returns

Field Type Description
local_filestringPath to local version
depot_filestringPath to temp file containing depot version
depot_revisionstringRevision identifier of the depot version
is_modifiedbooleanWhether the local file differs from depot
display_statusstringHuman-readable status name

Example Request

{
  "jsonrpc": "2.0",
  "id": 6,
  "method": "editor.sourcecontrol.diff",
  "params": {
    "file": "/Game/Maps/MainLevel"
  }
}

editor.sourcecontrol.sync

Sync file(s) to the latest version from the depot/repository (or a specific revision).

Name Type Required Description
filesarray<string>YesPackage paths or disk file paths to sync
revisionstringNoSpecific revision to sync to (default: head/latest)

Returns

Field Type Description
successbooleanWhether the sync succeeded
file_countnumberNumber of files processed
errorstring(optional) Error message if sync failed

Example Request

{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "editor.sourcecontrol.sync",
  "params": {
    "files": ["/Game/Maps/MainLevel"]
  }
}

editor.sourcecontrol.getChangelists

List pending changelists from source control. Only available with providers that support changelists (e.g. Perforce).

No parameters.

Returns

Field Type Description
providerstringName of the active source control provider
countnumberNumber of changelists
changelistsarray<object>Changelist entries
changelists[].identifierstringChangelist number/identifier
changelists[].is_defaultbooleanWhether this is the default changelist
changelists[].can_deletebooleanWhether this changelist can be deleted

Example Request

{
  "jsonrpc": "2.0",
  "id": 8,
  "method": "editor.sourcecontrol.getChangelists",
  "params": {}
}

Example Response

{
  "jsonrpc": "2.0",
  "id": 8,
  "result": {
    "provider": "Perforce",
    "count": 2,
    "changelists": [
      {
        "identifier": "default",
        "is_default": true,
        "can_delete": false
      },
      {
        "identifier": "54321",
        "is_default": false,
        "can_delete": true
      }
    ]
  }
}