2019-09-03 14:31:14 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 08:08:05 +00:00
<class name= "EditorVCSInterface" inherits= "Object" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2019-09-03 14:31:14 +00:00
<brief_description >
2022-08-09 21:56:19 +00:00
Version Control System (VCS) interface, which reads and writes to the local VCS in use.
2019-09-03 14:31:14 +00:00
</brief_description>
<description >
2022-08-09 21:56:19 +00:00
Defines the API that the editor uses to extract information from the underlying VCS. The implementation of this API is included in VCS plugins, which are GDExtension plugins that inherit [EditorVCSInterface] and are attached (on demand) to the singleton instance of [EditorVCSInterface]. Instead of performing the task themselves, all the virtual functions listed below are calling the internally overridden functions in the VCS plugins to provide a plug-n-play experience. A custom VCS plugin is supposed to inherit from [EditorVCSInterface] and override each of these virtual functions.
2019-09-03 14:31:14 +00:00
</description>
<tutorials >
</tutorials>
<methods >
2022-08-09 21:56:19 +00:00
<method name= "_checkout_branch" qualifiers= "virtual" >
<return type= "bool" />
<param index= "0" name= "branch_name" type= "String" />
<description >
2023-04-26 19:36:04 +00:00
Checks out a [param branch_name] in the VCS.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "_commit" qualifiers= "virtual" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "msg" type= "String" />
2019-09-03 14:31:14 +00:00
<description >
2023-04-26 19:36:04 +00:00
Commits the currently staged changes and applies the commit [param msg] to the resulting commit.
2019-09-03 14:31:14 +00:00
</description>
</method>
2022-08-09 21:56:19 +00:00
<method name= "_create_branch" qualifiers= "virtual" >
<return type= "void" />
<param index= "0" name= "branch_name" type= "String" />
<description >
2023-04-26 19:36:04 +00:00
Creates a new branch named [param branch_name] in the VCS.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "_create_remote" qualifiers= "virtual" >
<return type= "void" />
<param index= "0" name= "remote_name" type= "String" />
<param index= "1" name= "remote_url" type= "String" />
<description >
2023-04-26 19:36:04 +00:00
Creates a new remote destination with name [param remote_name] and points it to [param remote_url]. This can be an HTTPS remote or an SSH remote.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "_discard_file" qualifiers= "virtual" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "file_path" type= "String" />
2019-09-03 14:31:14 +00:00
<description >
2023-04-26 19:36:04 +00:00
Discards the changes made in a file present at [param file_path].
2019-09-03 14:31:14 +00:00
</description>
</method>
2022-08-09 21:56:19 +00:00
<method name= "_fetch" qualifiers= "virtual" >
<return type= "void" />
<param index= "0" name= "remote" type= "String" />
2019-09-03 14:31:14 +00:00
<description >
2023-04-26 19:36:04 +00:00
Fetches new changes from the [param remote], but doesn't write changes to the current working directory. Equivalent to [code]git fetch[/code].
2019-09-03 14:31:14 +00:00
</description>
</method>
2022-08-09 21:56:19 +00:00
<method name= "_get_branch_list" qualifiers= "virtual" >
2022-12-20 10:06:14 +00:00
<return type= "String[]" />
2022-08-09 21:56:19 +00:00
<description >
Gets an instance of an [Array] of [String]s containing available branch names in the VCS.
</description>
</method>
<method name= "_get_current_branch_name" qualifiers= "virtual" >
2021-07-30 13:28:05 +00:00
<return type= "String" />
2019-09-03 14:31:14 +00:00
<description >
2022-08-09 21:56:19 +00:00
Gets the current branch name defined in the VCS.
</description>
</method>
<method name= "_get_diff" qualifiers= "virtual" >
<return type= "Dictionary[]" />
<param index= "0" name= "identifier" type= "String" />
<param index= "1" name= "area" type= "int" />
<description >
2023-04-26 19:36:04 +00:00
Returns an array of [Dictionary] items (see [method create_diff_file], [method create_diff_hunk], [method create_diff_line], [method add_line_diffs_into_diff_hunk] and [method add_diff_hunks_into_diff_file]), each containing information about a diff. If [param identifier] is a file path, returns a file diff, and if it is a commit identifier, then returns a commit diff.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "_get_line_diff" qualifiers= "virtual" >
2022-08-31 17:24:04 +00:00
<return type= "Dictionary[]" />
2022-08-09 21:56:19 +00:00
<param index= "0" name= "file_path" type= "String" />
<param index= "1" name= "text" type= "String" />
<description >
2023-04-26 19:36:04 +00:00
Returns an [Array] of [Dictionary] items (see [method create_diff_hunk]), each containing a line diff between a file at [param file_path] and the [param text] which is passed in.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "_get_modified_files_data" qualifiers= "virtual" >
2022-08-31 17:24:04 +00:00
<return type= "Dictionary[]" />
2022-08-09 21:56:19 +00:00
<description >
Returns an [Array] of [Dictionary] items (see [method create_status_file]), each containing the status data of every modified file in the project folder.
</description>
</method>
<method name= "_get_previous_commits" qualifiers= "virtual" >
2022-08-31 17:24:04 +00:00
<return type= "Dictionary[]" />
2022-08-09 21:56:19 +00:00
<param index= "0" name= "max_commits" type= "int" />
<description >
Returns an [Array] of [Dictionary] items (see [method create_commit]), each containing the data for a past commit.
2019-09-03 14:31:14 +00:00
</description>
</method>
2022-08-09 21:56:19 +00:00
<method name= "_get_remotes" qualifiers= "virtual" >
2022-12-20 10:06:14 +00:00
<return type= "String[]" />
2022-08-09 21:56:19 +00:00
<description >
Returns an [Array] of [String]s, each containing the name of a remote configured in the VCS.
</description>
</method>
<method name= "_get_vcs_name" qualifiers= "virtual" >
2021-07-30 13:28:05 +00:00
<return type= "String" />
2019-09-03 14:31:14 +00:00
<description >
2022-08-09 21:56:19 +00:00
Returns the name of the underlying VCS provider.
2019-09-03 14:31:14 +00:00
</description>
</method>
2022-08-09 21:56:19 +00:00
<method name= "_initialize" qualifiers= "virtual" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-09 21:56:19 +00:00
<param index= "0" name= "project_path" type= "String" />
2019-09-03 14:31:14 +00:00
<description >
2023-04-26 19:36:04 +00:00
Initializes the VCS plugin when called from the editor. Returns whether or not the plugin was successfully initialized. A VCS project is initialized at [param project_path].
2019-09-03 14:31:14 +00:00
</description>
</method>
2022-08-09 21:56:19 +00:00
<method name= "_pull" qualifiers= "virtual" >
<return type= "void" />
<param index= "0" name= "remote" type= "String" />
2019-09-03 14:31:14 +00:00
<description >
2022-08-09 21:56:19 +00:00
Pulls changes from the remote. This can give rise to merge conflicts.
2019-09-03 14:31:14 +00:00
</description>
2019-11-22 07:35:03 +00:00
</method>
2022-08-09 21:56:19 +00:00
<method name= "_push" qualifiers= "virtual" >
<return type= "void" />
<param index= "0" name= "remote" type= "String" />
<param index= "1" name= "force" type= "bool" />
<description >
2023-03-16 05:56:09 +00:00
Pushes changes to the [param remote]. If [param force] is [code]true[/code], a force push will override the change history already present on the remote.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "_remove_branch" qualifiers= "virtual" >
<return type= "void" />
<param index= "0" name= "branch_name" type= "String" />
2019-11-22 07:35:03 +00:00
<description >
2022-08-09 21:56:19 +00:00
Remove a branch from the local VCS.
2019-11-22 07:35:03 +00:00
</description>
2019-09-03 14:31:14 +00:00
</method>
2022-08-09 21:56:19 +00:00
<method name= "_remove_remote" qualifiers= "virtual" >
<return type= "void" />
<param index= "0" name= "remote_name" type= "String" />
<description >
Remove a remote from the local VCS.
</description>
</method>
<method name= "_set_credentials" qualifiers= "virtual" >
<return type= "void" />
<param index= "0" name= "username" type= "String" />
<param index= "1" name= "password" type= "String" />
<param index= "2" name= "ssh_public_key_path" type= "String" />
<param index= "3" name= "ssh_private_key_path" type= "String" />
<param index= "4" name= "ssh_passphrase" type= "String" />
<description >
2023-04-26 19:36:04 +00:00
Set user credentials in the underlying VCS. [param username] and [param password] are used only during HTTPS authentication unless not already mentioned in the remote URL. [param ssh_public_key_path], [param ssh_private_key_path], and [param ssh_passphrase] are only used during SSH authentication.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "_shut_down" qualifiers= "virtual" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2019-09-03 14:31:14 +00:00
<description >
2022-08-09 21:56:19 +00:00
Shuts down VCS plugin instance. Called when the user either closes the editor or shuts down the VCS plugin through the editor UI.
2019-09-03 14:31:14 +00:00
</description>
</method>
2022-08-09 21:56:19 +00:00
<method name= "_stage_file" qualifiers= "virtual" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "file_path" type= "String" />
2019-09-03 14:31:14 +00:00
<description >
2023-04-26 19:36:04 +00:00
Stages the file present at [param file_path] to the staged area.
2019-09-03 14:31:14 +00:00
</description>
</method>
2022-08-09 21:56:19 +00:00
<method name= "_unstage_file" qualifiers= "virtual" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "file_path" type= "String" />
2019-09-03 14:31:14 +00:00
<description >
2023-04-26 19:36:04 +00:00
Unstages the file present at [param file_path] from the staged area to the unstaged area.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "add_diff_hunks_into_diff_file" >
<return type= "Dictionary" />
<param index= "0" name= "diff_file" type= "Dictionary" />
2022-08-31 17:24:04 +00:00
<param index= "1" name= "diff_hunks" type= "Dictionary[]" />
2022-08-09 21:56:19 +00:00
<description >
2023-04-26 19:36:04 +00:00
Helper function to add an array of [param diff_hunks] into a [param diff_file].
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "add_line_diffs_into_diff_hunk" >
<return type= "Dictionary" />
<param index= "0" name= "diff_hunk" type= "Dictionary" />
2022-08-31 17:24:04 +00:00
<param index= "1" name= "line_diffs" type= "Dictionary[]" />
2022-08-09 21:56:19 +00:00
<description >
2023-04-26 19:36:04 +00:00
Helper function to add an array of [param line_diffs] into a [param diff_hunk].
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "create_commit" >
<return type= "Dictionary" />
<param index= "0" name= "msg" type= "String" />
<param index= "1" name= "author" type= "String" />
<param index= "2" name= "id" type= "String" />
<param index= "3" name= "unix_timestamp" type= "int" />
<param index= "4" name= "offset_minutes" type= "int" />
<description >
2023-04-26 19:36:04 +00:00
Helper function to create a commit [Dictionary] item. [param msg] is the commit message of the commit. [param author] is a single human-readable string containing all the author's details, e.g. the email and name configured in the VCS. [param id] is the identifier of the commit, in whichever format your VCS may provide an identifier to commits. [param unix_timestamp] is the UTC Unix timestamp of when the commit was created. [param offset_minutes] is the timezone offset in minutes, recorded from the system timezone where the commit was created.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "create_diff_file" >
<return type= "Dictionary" />
<param index= "0" name= "new_file" type= "String" />
<param index= "1" name= "old_file" type= "String" />
<description >
2023-04-26 19:36:04 +00:00
Helper function to create a [Dictionary] for storing old and new diff file paths.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "create_diff_hunk" >
<return type= "Dictionary" />
<param index= "0" name= "old_start" type= "int" />
<param index= "1" name= "new_start" type= "int" />
<param index= "2" name= "old_lines" type= "int" />
<param index= "3" name= "new_lines" type= "int" />
<description >
2023-04-26 19:36:04 +00:00
Helper function to create a [Dictionary] for storing diff hunk data. [param old_start] is the starting line number in old file. [param new_start] is the starting line number in new file. [param old_lines] is the number of lines in the old file. [param new_lines] is the number of lines in the new file.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "create_diff_line" >
<return type= "Dictionary" />
<param index= "0" name= "new_line_no" type= "int" />
<param index= "1" name= "old_line_no" type= "int" />
<param index= "2" name= "content" type= "String" />
<param index= "3" name= "status" type= "String" />
<description >
2023-04-26 19:36:04 +00:00
Helper function to create a [Dictionary] for storing a line diff. [param new_line_no] is the line number in the new file (can be [code]-1[/code] if the line is deleted). [param old_line_no] is the line number in the old file (can be [code]-1[/code] if the line is added). [param content] is the diff text. [param status] is a single character string which stores the line origin.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "create_status_file" >
<return type= "Dictionary" />
<param index= "0" name= "file_path" type= "String" />
<param index= "1" name= "change_type" type= "int" enum= "EditorVCSInterface.ChangeType" />
<param index= "2" name= "area" type= "int" enum= "EditorVCSInterface.TreeArea" />
<description >
2023-04-26 19:36:04 +00:00
Helper function to create a [Dictionary] used by editor to read the status of a file.
2022-08-09 21:56:19 +00:00
</description>
</method>
<method name= "popup_error" >
<return type= "void" />
<param index= "0" name= "msg" type= "String" />
<description >
Pops up an error message in the edior which is shown as coming from the underlying VCS. Use this to show VCS specific error messages.
2019-09-03 14:31:14 +00:00
</description>
</method>
</methods>
2022-08-09 21:56:19 +00:00
<constants >
<constant name= "CHANGE_TYPE_NEW" value= "0" enum= "ChangeType" >
A new file has been added.
</constant>
<constant name= "CHANGE_TYPE_MODIFIED" value= "1" enum= "ChangeType" >
An earlier added file has been modified.
</constant>
<constant name= "CHANGE_TYPE_RENAMED" value= "2" enum= "ChangeType" >
An earlier added file has been renamed.
</constant>
<constant name= "CHANGE_TYPE_DELETED" value= "3" enum= "ChangeType" >
An earlier added file has been deleted.
</constant>
<constant name= "CHANGE_TYPE_TYPECHANGE" value= "4" enum= "ChangeType" >
An earlier added file has been typechanged.
</constant>
<constant name= "CHANGE_TYPE_UNMERGED" value= "5" enum= "ChangeType" >
A file is left unmerged.
</constant>
<constant name= "TREE_AREA_COMMIT" value= "0" enum= "TreeArea" >
A commit is encountered from the commit area.
</constant>
<constant name= "TREE_AREA_STAGED" value= "1" enum= "TreeArea" >
A file is encountered from the staged area.
</constant>
<constant name= "TREE_AREA_UNSTAGED" value= "2" enum= "TreeArea" >
A file is encountered from the unstaged area.
</constant>
</constants>
2019-09-03 14:31:14 +00:00
</class>