Merge pull request #62157 from ChronicallySerious/front-port-vcs-plugin
VCS: Port Godot 3.5's VCS features to GDExtension
This commit is contained in:
commit
36a5160ad7
10 changed files with 2187 additions and 610 deletions
|
@ -1,97 +1,276 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="EditorVCSInterface" inherits="Object" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
||||
<brief_description>
|
||||
Version Control System (VCS) interface which reads and writes to the local VCS in use.
|
||||
Version Control System (VCS) interface, which reads and writes to the local VCS in use.
|
||||
</brief_description>
|
||||
<description>
|
||||
Used by the editor to display VCS extracted information in the editor. The implementation of this API is included in VCS addons, which are essentially GDExtension plugins that need to be put into the project folder. These VCS addons are scripts which are attached (on demand) to the object instance of [code]EditorVCSInterface[/code]. All the functions listed below, instead of performing the task themselves, they call the internally defined functions in the VCS addons to provide a plug-n-play experience.
|
||||
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.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="commit">
|
||||
<method name="_checkout_branch" qualifiers="virtual">
|
||||
<return type="bool" />
|
||||
<param index="0" name="branch_name" type="String" />
|
||||
<description>
|
||||
Checks out a [code]branch_name[/code] in the VCS.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_commit" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="msg" type="String" />
|
||||
<description>
|
||||
Creates a version commit if the addon is initialized, else returns without doing anything. Uses the files which have been staged previously, with the commit message set to a value as provided as in the argument.
|
||||
Commits the currently staged changes and applies the commit [code]msg[/code] to the resulting commit.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_file_diff">
|
||||
<method name="_create_branch" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="branch_name" type="String" />
|
||||
<description>
|
||||
Creates a new branch named [code]branch_name[/code] in the VCS.
|
||||
</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>
|
||||
Creates a new remote destination with name [code]remote_name[/code] and points it to [code]remote_url[/code]. This can be an HTTPS remote or an SSH remote.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_discard_file" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="file_path" type="String" />
|
||||
<description>
|
||||
Discards the changes made in a file present at [code]file_path[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_fetch" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="remote" type="String" />
|
||||
<description>
|
||||
Fetches new changes from the remote, but doesn't write changes to the current working directory. Equivalent to [code]git fetch[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_branch_list" qualifiers="virtual">
|
||||
<return type="Array" />
|
||||
<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">
|
||||
<return type="String" />
|
||||
<description>
|
||||
Gets the current branch name defined in the VCS.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_diff" qualifiers="virtual">
|
||||
<return type="Dictionary[]" />
|
||||
<param index="0" name="file_path" type="String" />
|
||||
<param index="0" name="identifier" type="String" />
|
||||
<param index="1" name="area" type="int" />
|
||||
<description>
|
||||
Returns an [Array] of [Dictionary] objects containing the diff output from the VCS in use, if a VCS addon is initialized, else returns an empty [Array] object. The diff contents also consist of some contextual lines which provide context to the observed line change in the file.
|
||||
Each [Dictionary] object has the line diff contents under the keys:
|
||||
- [code]"content"[/code] to store a [String] containing the line contents
|
||||
- [code]"status"[/code] to store a [String] which contains [code]"+"[/code] in case the content is a line addition but it stores a [code]"-"[/code] in case of deletion and an empty string in the case the line content is neither an addition nor a deletion.
|
||||
- [code]"new_line_number"[/code] to store an integer containing the new line number of the line content.
|
||||
- [code]"line_count"[/code] to store an integer containing the number of lines in the line content.
|
||||
- [code]"old_line_number"[/code] to store an integer containing the old line number of the line content.
|
||||
- [code]"offset"[/code] to store the offset of the line change since the first contextual line content.
|
||||
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 [code]identifier[/code] is a file path, returns a file diff, and if it is a commit identifier, then returns a commit diff.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_modified_files_data">
|
||||
<method name="_get_line_diff" qualifiers="virtual">
|
||||
<return type="Array" />
|
||||
<param index="0" name="file_path" type="String" />
|
||||
<param index="1" name="text" type="String" />
|
||||
<description>
|
||||
Returns an [Array] of [Dictionary] items (see [method create_diff_hunk]), each containing a line diff between a file at [code]file_path[/code] and the [code]text[/code] which is passed in.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_modified_files_data" qualifiers="virtual">
|
||||
<return type="Array" />
|
||||
<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">
|
||||
<return type="Array" />
|
||||
<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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_remotes" qualifiers="virtual">
|
||||
<return type="Array" />
|
||||
<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">
|
||||
<return type="String" />
|
||||
<description>
|
||||
Returns the name of the underlying VCS provider.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_initialize" qualifiers="virtual">
|
||||
<return type="bool" />
|
||||
<param index="0" name="project_path" type="String" />
|
||||
<description>
|
||||
Initializes the VCS plugin when called from the editor. Returns whether or not the plugin was successfully initialized. A VCS project is initialized at [code]project_path[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_pull" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="remote" type="String" />
|
||||
<description>
|
||||
Pulls changes from the remote. This can give rise to merge conflicts.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_push" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="remote" type="String" />
|
||||
<param index="1" name="force" type="bool" />
|
||||
<description>
|
||||
Pushes changes to the [code]remote[/code]. Optionally, if [code]force[/code] is set to true, a force push will override the change history already present on the remote.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_remove_branch" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="branch_name" type="String" />
|
||||
<description>
|
||||
Remove a branch from the local VCS.
|
||||
</description>
|
||||
</method>
|
||||
<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>
|
||||
Set user credentials in the underlying VCS. [code]username[/code] and [code]password[/code] are used only during HTTPS authentication unless not already mentioned in the remote URL. [code]ssh_public_key_path[/code], [code]ssh_private_key_path[/code], and [code]ssh_passphrase[/code] are only used during SSH authentication.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_shut_down" qualifiers="virtual">
|
||||
<return type="bool" />
|
||||
<description>
|
||||
Shuts down VCS plugin instance. Called when the user either closes the editor or shuts down the VCS plugin through the editor UI.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_stage_file" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="file_path" type="String" />
|
||||
<description>
|
||||
Stages the file present at [code]file_path[/code] to the staged area.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_unstage_file" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="file_path" type="String" />
|
||||
<description>
|
||||
Unstages the file present at [code]file_path[/code] from the staged area to the unstaged area.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_diff_hunks_into_diff_file">
|
||||
<return type="Dictionary" />
|
||||
<param index="0" name="diff_file" type="Dictionary" />
|
||||
<param index="1" name="diff_hunks" type="Array" />
|
||||
<description>
|
||||
Returns a [Dictionary] containing the path of the detected file change mapped to an integer signifying what kind of change the corresponding file has experienced.
|
||||
The following integer values are being used to signify that the detected file is:
|
||||
- [code]0[/code]: New to the VCS working directory
|
||||
- [code]1[/code]: Modified
|
||||
- [code]2[/code]: Renamed
|
||||
- [code]3[/code]: Deleted
|
||||
- [code]4[/code]: Typechanged
|
||||
Helper function to add an array of [code]diff_hunks[/code] into a [code]diff_file[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_project_name">
|
||||
<return type="String" />
|
||||
<method name="add_line_diffs_into_diff_hunk">
|
||||
<return type="Dictionary" />
|
||||
<param index="0" name="diff_hunk" type="Dictionary" />
|
||||
<param index="1" name="line_diffs" type="Array" />
|
||||
<description>
|
||||
Returns the project name of the VCS working directory.
|
||||
Helper function to add an array of [code]line_diffs[/code] into a [code]diff_hunk[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_vcs_name">
|
||||
<return type="String" />
|
||||
<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>
|
||||
Returns the name of the VCS if the VCS has been initialized, else return an empty string.
|
||||
Helper function to create a commit [Dictionary] item. [code]msg[/code] is the commit message of the commit. [code]author[/code] is a single human-readable string containing all the author's details, e.g. the email and name configured in the VCS. [code]id[/code] is the identifier of the commit, in whichever format your VCS may provide an identifier to commits. [code]unix_timestamp[/code] is the UTC Unix timestamp of when the commit was created. [code]offset_minutes[/code] is the timezone offset in minutes, recorded from the system timezone where the commit was created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="initialize">
|
||||
<return type="bool" />
|
||||
<param index="0" name="project_root_path" type="String" />
|
||||
<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>
|
||||
Initializes the VCS addon if not already. Uses the argument value as the path to the working directory of the project. Creates the initial commit if required. Returns [code]true[/code] if no failure occurs, else returns [code]false[/code].
|
||||
Helper function to create a [code]Dictionary[/code] for storing old and new diff file paths.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_addon_ready">
|
||||
<return type="bool" />
|
||||
<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>
|
||||
Returns [code]true[/code] if the addon is ready to respond to function calls, else returns [code]false[/code].
|
||||
Helper function to create a [code]Dictionary[/code] for storing diff hunk data. [code]old_start[/code] is the starting line number in old file. [code]new_start[/code] is the starting line number in new file. [code]old_lines[/code] is the number of lines in the old file. [code]new_lines[/code] is the number of lines in the new file.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_vcs_initialized">
|
||||
<return type="bool" />
|
||||
<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>
|
||||
Returns [code]true[/code] if the VCS addon has been initialized, else returns [code]false[/code].
|
||||
Helper function to create a [code]Dictionary[/code] for storing a line diff. [code]new_line_no[/code] is the line number in the new file (can be [code]-1[/code] if the line is deleted). [code]old_line_no[/code] is the line number in the old file (can be [code]-1[/code] if the line is added). [code]content[/code] is the diff text. [code]status[/code] is a single character string which stores the line origin.
|
||||
</description>
|
||||
</method>
|
||||
<method name="shut_down">
|
||||
<return type="bool" />
|
||||
<description>
|
||||
Shuts down the VCS addon to allow cleanup code to run on call. Returns [code]true[/code] is no failure occurs, else returns [code]false[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="stage_file">
|
||||
<return type="void" />
|
||||
<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>
|
||||
Stages the file which should be committed when [method EditorVCSInterface.commit] is called. Argument should contain the absolute path.
|
||||
Helper function to create a [code]Dictionary[/code] used by editor to read the status of a file.
|
||||
</description>
|
||||
</method>
|
||||
<method name="unstage_file">
|
||||
<method name="popup_error">
|
||||
<return type="void" />
|
||||
<param index="0" name="file_path" type="String" />
|
||||
<param index="0" name="msg" type="String" />
|
||||
<description>
|
||||
Unstages the file which was staged previously to be committed, so that it is no longer committed when [method EditorVCSInterface.commit] is called. Argument should contain the absolute path.
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<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>
|
||||
</class>
|
||||
|
|
|
@ -420,9 +420,6 @@ void EditorNode::_version_control_menu_option(int p_idx) {
|
|||
case RUN_VCS_SETTINGS: {
|
||||
VersionControlEditorPlugin::get_singleton()->popup_vcs_set_up_dialog(gui_base);
|
||||
} break;
|
||||
case RUN_VCS_SHUT_DOWN: {
|
||||
VersionControlEditorPlugin::get_singleton()->shut_down();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6741,8 +6738,7 @@ EditorNode::EditorNode() {
|
|||
project_menu->add_child(vcs_actions_menu);
|
||||
project_menu->add_submenu_item(TTR("Version Control"), "Version Control");
|
||||
vcs_actions_menu->add_item(TTR("Create Version Control Metadata"), RUN_VCS_METADATA);
|
||||
vcs_actions_menu->add_item(TTR("Set Up Version Control"), RUN_VCS_SETTINGS);
|
||||
vcs_actions_menu->add_item(TTR("Shut Down Version Control"), RUN_VCS_SHUT_DOWN);
|
||||
vcs_actions_menu->add_item(TTR("Version Control Settings"), RUN_VCS_SETTINGS);
|
||||
|
||||
project_menu->add_separator();
|
||||
project_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/export", TTR("Export..."), Key::NONE, TTR("Export")), FILE_EXPORT_PROJECT);
|
||||
|
|
|
@ -185,7 +185,6 @@ private:
|
|||
RUN_PROJECT_MANAGER,
|
||||
RUN_VCS_METADATA,
|
||||
RUN_VCS_SETTINGS,
|
||||
RUN_VCS_SHUT_DOWN,
|
||||
SETTINGS_UPDATE_CONTINUOUSLY,
|
||||
SETTINGS_UPDATE_WHEN_CHANGED,
|
||||
SETTINGS_UPDATE_ALWAYS,
|
||||
|
|
|
@ -30,132 +30,371 @@
|
|||
|
||||
#include "editor_vcs_interface.h"
|
||||
|
||||
#include "editor_node.h"
|
||||
|
||||
#define UNIMPLEMENTED() ERR_PRINT(vformat("Unimplemented virtual function in EditorVCSInterface based plugin: %s", __func__))
|
||||
|
||||
EditorVCSInterface *EditorVCSInterface::singleton = nullptr;
|
||||
|
||||
void EditorVCSInterface::_bind_methods() {
|
||||
// Proxy end points that act as fallbacks to unavailability of a function in the VCS addon
|
||||
ClassDB::bind_method(D_METHOD("_initialize", "project_root_path"), &EditorVCSInterface::_initialize);
|
||||
ClassDB::bind_method(D_METHOD("_is_vcs_initialized"), &EditorVCSInterface::_is_vcs_initialized);
|
||||
ClassDB::bind_method(D_METHOD("_get_vcs_name"), &EditorVCSInterface::_get_vcs_name);
|
||||
ClassDB::bind_method(D_METHOD("_shut_down"), &EditorVCSInterface::_shut_down);
|
||||
ClassDB::bind_method(D_METHOD("_get_project_name"), &EditorVCSInterface::_get_project_name);
|
||||
ClassDB::bind_method(D_METHOD("_get_modified_files_data"), &EditorVCSInterface::_get_modified_files_data);
|
||||
ClassDB::bind_method(D_METHOD("_commit", "msg"), &EditorVCSInterface::_commit);
|
||||
ClassDB::bind_method(D_METHOD("_get_file_diff", "file_path"), &EditorVCSInterface::_get_file_diff);
|
||||
ClassDB::bind_method(D_METHOD("_stage_file", "file_path"), &EditorVCSInterface::_stage_file);
|
||||
ClassDB::bind_method(D_METHOD("_unstage_file", "file_path"), &EditorVCSInterface::_unstage_file);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("is_addon_ready"), &EditorVCSInterface::is_addon_ready);
|
||||
|
||||
// API methods that redirect calls to the proxy end points
|
||||
ClassDB::bind_method(D_METHOD("initialize", "project_root_path"), &EditorVCSInterface::initialize);
|
||||
ClassDB::bind_method(D_METHOD("is_vcs_initialized"), &EditorVCSInterface::is_vcs_initialized);
|
||||
ClassDB::bind_method(D_METHOD("get_modified_files_data"), &EditorVCSInterface::get_modified_files_data);
|
||||
ClassDB::bind_method(D_METHOD("stage_file", "file_path"), &EditorVCSInterface::stage_file);
|
||||
ClassDB::bind_method(D_METHOD("unstage_file", "file_path"), &EditorVCSInterface::unstage_file);
|
||||
ClassDB::bind_method(D_METHOD("commit", "msg"), &EditorVCSInterface::commit);
|
||||
ClassDB::bind_method(D_METHOD("get_file_diff", "file_path"), &EditorVCSInterface::get_file_diff);
|
||||
ClassDB::bind_method(D_METHOD("shut_down"), &EditorVCSInterface::shut_down);
|
||||
ClassDB::bind_method(D_METHOD("get_project_name"), &EditorVCSInterface::get_project_name);
|
||||
ClassDB::bind_method(D_METHOD("get_vcs_name"), &EditorVCSInterface::get_vcs_name);
|
||||
void EditorVCSInterface::popup_error(String p_msg) {
|
||||
// TRANSLATORS: %s refers to the name of a version control system (e.g. "Git").
|
||||
EditorNode::get_singleton()->show_warning(p_msg.strip_edges(), vformat(TTR("%s Error"), get_vcs_name()));
|
||||
}
|
||||
|
||||
bool EditorVCSInterface::_initialize(String p_project_root_path) {
|
||||
WARN_PRINT("Selected VCS addon does not implement an initialization function. This warning will be suppressed.");
|
||||
return true;
|
||||
bool EditorVCSInterface::initialize(String p_project_path) {
|
||||
bool result = false;
|
||||
if (!GDVIRTUAL_CALL(_initialize, p_project_path, result)) {
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool EditorVCSInterface::_is_vcs_initialized() {
|
||||
return false;
|
||||
void EditorVCSInterface::set_credentials(String p_username, String p_password, String p_ssh_public_key, String p_ssh_private_key, String p_ssh_passphrase) {
|
||||
if (!GDVIRTUAL_CALL(_set_credentials, p_username, p_password, p_ssh_public_key, p_ssh_private_key, p_ssh_passphrase)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary EditorVCSInterface::_get_modified_files_data() {
|
||||
return Dictionary();
|
||||
List<String> EditorVCSInterface::get_remotes() {
|
||||
Array result;
|
||||
if (!GDVIRTUAL_CALL(_get_remotes, result)) {
|
||||
UNIMPLEMENTED();
|
||||
return {};
|
||||
}
|
||||
|
||||
List<String> remotes;
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
remotes.push_back(result[i]);
|
||||
}
|
||||
return remotes;
|
||||
}
|
||||
|
||||
void EditorVCSInterface::_stage_file(String p_file_path) {
|
||||
}
|
||||
List<EditorVCSInterface::StatusFile> EditorVCSInterface::get_modified_files_data() {
|
||||
Array result;
|
||||
if (!GDVIRTUAL_CALL(_get_modified_files_data, result)) {
|
||||
UNIMPLEMENTED();
|
||||
return {};
|
||||
}
|
||||
|
||||
void EditorVCSInterface::_unstage_file(String p_file_path) {
|
||||
}
|
||||
|
||||
void EditorVCSInterface::_commit(String p_msg) {
|
||||
}
|
||||
|
||||
TypedArray<Dictionary> EditorVCSInterface::_get_file_diff(String p_file_path) {
|
||||
return TypedArray<Dictionary>();
|
||||
}
|
||||
|
||||
bool EditorVCSInterface::_shut_down() {
|
||||
return false;
|
||||
}
|
||||
|
||||
String EditorVCSInterface::_get_project_name() {
|
||||
return String();
|
||||
}
|
||||
|
||||
String EditorVCSInterface::_get_vcs_name() {
|
||||
return "";
|
||||
}
|
||||
|
||||
bool EditorVCSInterface::initialize(String p_project_root_path) {
|
||||
is_initialized = call("_initialize", p_project_root_path);
|
||||
return is_initialized;
|
||||
}
|
||||
|
||||
bool EditorVCSInterface::is_vcs_initialized() {
|
||||
return call("_is_vcs_initialized");
|
||||
}
|
||||
|
||||
Dictionary EditorVCSInterface::get_modified_files_data() {
|
||||
return call("_get_modified_files_data");
|
||||
List<EditorVCSInterface::StatusFile> status_files;
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
status_files.push_back(_convert_status_file(result[i]));
|
||||
}
|
||||
return status_files;
|
||||
}
|
||||
|
||||
void EditorVCSInterface::stage_file(String p_file_path) {
|
||||
if (is_addon_ready()) {
|
||||
call("_stage_file", p_file_path);
|
||||
if (!GDVIRTUAL_CALL(_stage_file, p_file_path)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorVCSInterface::unstage_file(String p_file_path) {
|
||||
if (is_addon_ready()) {
|
||||
call("_unstage_file", p_file_path);
|
||||
if (!GDVIRTUAL_CALL(_unstage_file, p_file_path)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
bool EditorVCSInterface::is_addon_ready() {
|
||||
return is_initialized;
|
||||
void EditorVCSInterface::discard_file(String p_file_path) {
|
||||
if (!GDVIRTUAL_CALL(_discard_file, p_file_path)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorVCSInterface::commit(String p_msg) {
|
||||
if (is_addon_ready()) {
|
||||
call("_commit", p_msg);
|
||||
if (!GDVIRTUAL_CALL(_commit, p_msg)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
TypedArray<Dictionary> EditorVCSInterface::get_file_diff(String p_file_path) {
|
||||
if (is_addon_ready()) {
|
||||
return call("_get_file_diff", p_file_path);
|
||||
List<EditorVCSInterface::DiffFile> EditorVCSInterface::get_diff(String p_identifier, TreeArea p_area) {
|
||||
TypedArray<Dictionary> result;
|
||||
if (!GDVIRTUAL_CALL(_get_diff, p_identifier, int(p_area), result)) {
|
||||
UNIMPLEMENTED();
|
||||
return {};
|
||||
}
|
||||
return TypedArray<Dictionary>();
|
||||
|
||||
List<DiffFile> diff_files;
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
diff_files.push_back(_convert_diff_file(result[i]));
|
||||
}
|
||||
return diff_files;
|
||||
}
|
||||
|
||||
List<EditorVCSInterface::Commit> EditorVCSInterface::get_previous_commits(int p_max_commits) {
|
||||
Array result;
|
||||
if (!GDVIRTUAL_CALL(_get_previous_commits, p_max_commits, result)) {
|
||||
UNIMPLEMENTED();
|
||||
return {};
|
||||
}
|
||||
|
||||
List<EditorVCSInterface::Commit> commits;
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
commits.push_back(_convert_commit(result[i]));
|
||||
}
|
||||
return commits;
|
||||
}
|
||||
|
||||
List<String> EditorVCSInterface::get_branch_list() {
|
||||
Array result;
|
||||
if (!GDVIRTUAL_CALL(_get_branch_list, result)) {
|
||||
UNIMPLEMENTED();
|
||||
return {};
|
||||
}
|
||||
|
||||
List<String> branch_list;
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
branch_list.push_back(result[i]);
|
||||
}
|
||||
return branch_list;
|
||||
}
|
||||
|
||||
void EditorVCSInterface::create_branch(String p_branch_name) {
|
||||
if (!GDVIRTUAL_CALL(_create_branch, p_branch_name)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorVCSInterface::create_remote(String p_remote_name, String p_remote_url) {
|
||||
if (!GDVIRTUAL_CALL(_create_remote, p_remote_name, p_remote_url)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorVCSInterface::remove_branch(String p_branch_name) {
|
||||
if (!GDVIRTUAL_CALL(_remove_branch, p_branch_name)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorVCSInterface::remove_remote(String p_remote_name) {
|
||||
if (!GDVIRTUAL_CALL(_remove_remote, p_remote_name)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
String EditorVCSInterface::get_current_branch_name() {
|
||||
String result;
|
||||
if (!GDVIRTUAL_CALL(_get_current_branch_name, result)) {
|
||||
UNIMPLEMENTED();
|
||||
return "";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool EditorVCSInterface::checkout_branch(String p_branch_name) {
|
||||
bool result = false;
|
||||
if (!GDVIRTUAL_CALL(_checkout_branch, p_branch_name, result)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void EditorVCSInterface::pull(String p_remote) {
|
||||
if (!GDVIRTUAL_CALL(_pull, p_remote)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorVCSInterface::push(String p_remote, bool p_force) {
|
||||
if (!GDVIRTUAL_CALL(_push, p_remote, p_force)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorVCSInterface::fetch(String p_remote) {
|
||||
if (!GDVIRTUAL_CALL(_fetch, p_remote)) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
List<EditorVCSInterface::DiffHunk> EditorVCSInterface::get_line_diff(String p_file_path, String p_text) {
|
||||
Array result;
|
||||
if (!GDVIRTUAL_CALL(_get_line_diff, p_file_path, p_text, result)) {
|
||||
UNIMPLEMENTED();
|
||||
return {};
|
||||
}
|
||||
|
||||
List<DiffHunk> diff_hunks;
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
diff_hunks.push_back(_convert_diff_hunk(result[i]));
|
||||
}
|
||||
return diff_hunks;
|
||||
}
|
||||
|
||||
bool EditorVCSInterface::shut_down() {
|
||||
return call("_shut_down");
|
||||
}
|
||||
|
||||
String EditorVCSInterface::get_project_name() {
|
||||
return call("_get_project_name");
|
||||
bool result = false;
|
||||
if (!GDVIRTUAL_CALL(_shut_down, result)) {
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
String EditorVCSInterface::get_vcs_name() {
|
||||
return call("_get_vcs_name");
|
||||
String result;
|
||||
if (!GDVIRTUAL_CALL(_get_vcs_name, result)) {
|
||||
UNIMPLEMENTED();
|
||||
return {};
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
EditorVCSInterface::EditorVCSInterface() {
|
||||
Dictionary EditorVCSInterface::create_diff_line(int p_new_line_no, int p_old_line_no, String p_content, String p_status) {
|
||||
Dictionary diff_line;
|
||||
diff_line["new_line_no"] = p_new_line_no;
|
||||
diff_line["old_line_no"] = p_old_line_no;
|
||||
diff_line["content"] = p_content;
|
||||
diff_line["status"] = p_status;
|
||||
|
||||
return diff_line;
|
||||
}
|
||||
|
||||
EditorVCSInterface::~EditorVCSInterface() {
|
||||
Dictionary EditorVCSInterface::create_diff_hunk(int p_old_start, int p_new_start, int p_old_lines, int p_new_lines) {
|
||||
Dictionary diff_hunk;
|
||||
diff_hunk["new_lines"] = p_new_lines;
|
||||
diff_hunk["old_lines"] = p_old_lines;
|
||||
diff_hunk["new_start"] = p_new_start;
|
||||
diff_hunk["old_start"] = p_old_start;
|
||||
diff_hunk["diff_lines"] = Array();
|
||||
return diff_hunk;
|
||||
}
|
||||
|
||||
Dictionary EditorVCSInterface::add_line_diffs_into_diff_hunk(Dictionary p_diff_hunk, Array p_line_diffs) {
|
||||
p_diff_hunk["diff_lines"] = p_line_diffs;
|
||||
return p_diff_hunk;
|
||||
}
|
||||
|
||||
Dictionary EditorVCSInterface::create_diff_file(String p_new_file, String p_old_file) {
|
||||
Dictionary file_diff;
|
||||
file_diff["new_file"] = p_new_file;
|
||||
file_diff["old_file"] = p_old_file;
|
||||
file_diff["diff_hunks"] = Array();
|
||||
return file_diff;
|
||||
}
|
||||
|
||||
Dictionary EditorVCSInterface::create_commit(String p_msg, String p_author, String p_id, int64_t p_unix_timestamp, int64_t p_offset_minutes) {
|
||||
Dictionary commit_info;
|
||||
commit_info["message"] = p_msg;
|
||||
commit_info["author"] = p_author;
|
||||
commit_info["unix_timestamp"] = p_unix_timestamp;
|
||||
commit_info["offset_minutes"] = p_offset_minutes;
|
||||
commit_info["id"] = p_id;
|
||||
return commit_info;
|
||||
}
|
||||
|
||||
Dictionary EditorVCSInterface::add_diff_hunks_into_diff_file(Dictionary p_diff_file, Array p_diff_hunks) {
|
||||
p_diff_file["diff_hunks"] = p_diff_hunks;
|
||||
return p_diff_file;
|
||||
}
|
||||
|
||||
Dictionary EditorVCSInterface::create_status_file(String p_file_path, ChangeType p_change, TreeArea p_area) {
|
||||
Dictionary sf;
|
||||
sf["file_path"] = p_file_path;
|
||||
sf["change_type"] = p_change;
|
||||
sf["area"] = p_area;
|
||||
return sf;
|
||||
}
|
||||
|
||||
EditorVCSInterface::DiffLine EditorVCSInterface::_convert_diff_line(Dictionary p_diff_line) {
|
||||
DiffLine d;
|
||||
d.new_line_no = p_diff_line["new_line_no"];
|
||||
d.old_line_no = p_diff_line["old_line_no"];
|
||||
d.content = p_diff_line["content"];
|
||||
d.status = p_diff_line["status"];
|
||||
return d;
|
||||
}
|
||||
|
||||
EditorVCSInterface::DiffHunk EditorVCSInterface::_convert_diff_hunk(Dictionary p_diff_hunk) {
|
||||
DiffHunk dh;
|
||||
dh.new_lines = p_diff_hunk["new_lines"];
|
||||
dh.old_lines = p_diff_hunk["old_lines"];
|
||||
dh.new_start = p_diff_hunk["new_start"];
|
||||
dh.old_start = p_diff_hunk["old_start"];
|
||||
Array diff_lines = p_diff_hunk["diff_lines"];
|
||||
for (int i = 0; i < diff_lines.size(); i++) {
|
||||
DiffLine dl = _convert_diff_line(diff_lines[i]);
|
||||
dh.diff_lines.push_back(dl);
|
||||
}
|
||||
return dh;
|
||||
}
|
||||
|
||||
EditorVCSInterface::DiffFile EditorVCSInterface::_convert_diff_file(Dictionary p_diff_file) {
|
||||
DiffFile df;
|
||||
df.new_file = p_diff_file["new_file"];
|
||||
df.old_file = p_diff_file["old_file"];
|
||||
Array diff_hunks = p_diff_file["diff_hunks"];
|
||||
for (int i = 0; i < diff_hunks.size(); i++) {
|
||||
DiffHunk dh = _convert_diff_hunk(diff_hunks[i]);
|
||||
df.diff_hunks.push_back(dh);
|
||||
}
|
||||
return df;
|
||||
}
|
||||
|
||||
EditorVCSInterface::Commit EditorVCSInterface::_convert_commit(Dictionary p_commit) {
|
||||
EditorVCSInterface::Commit c;
|
||||
c.msg = p_commit["message"];
|
||||
c.author = p_commit["author"];
|
||||
c.unix_timestamp = p_commit["unix_timestamp"];
|
||||
c.offset_minutes = p_commit["offset_minutes"];
|
||||
c.id = p_commit["id"];
|
||||
return c;
|
||||
}
|
||||
|
||||
EditorVCSInterface::StatusFile EditorVCSInterface::_convert_status_file(Dictionary p_status_file) {
|
||||
StatusFile sf;
|
||||
sf.file_path = p_status_file["file_path"];
|
||||
sf.change_type = (ChangeType)(int)p_status_file["change_type"];
|
||||
sf.area = (TreeArea)(int)p_status_file["area"];
|
||||
return sf;
|
||||
}
|
||||
|
||||
void EditorVCSInterface::_bind_methods() {
|
||||
// Proxy end points that implement the VCS specific operations that the editor demands.
|
||||
GDVIRTUAL_BIND(_initialize, "project_path");
|
||||
GDVIRTUAL_BIND(_set_credentials, "username", "password", "ssh_public_key_path", "ssh_private_key_path", "ssh_passphrase");
|
||||
GDVIRTUAL_BIND(_get_modified_files_data);
|
||||
GDVIRTUAL_BIND(_stage_file, "file_path");
|
||||
GDVIRTUAL_BIND(_unstage_file, "file_path");
|
||||
GDVIRTUAL_BIND(_discard_file, "file_path");
|
||||
GDVIRTUAL_BIND(_commit, "msg");
|
||||
GDVIRTUAL_BIND(_get_diff, "identifier", "area");
|
||||
GDVIRTUAL_BIND(_shut_down);
|
||||
GDVIRTUAL_BIND(_get_vcs_name);
|
||||
GDVIRTUAL_BIND(_get_previous_commits, "max_commits");
|
||||
GDVIRTUAL_BIND(_get_branch_list);
|
||||
GDVIRTUAL_BIND(_get_remotes);
|
||||
GDVIRTUAL_BIND(_create_branch, "branch_name");
|
||||
GDVIRTUAL_BIND(_remove_branch, "branch_name");
|
||||
GDVIRTUAL_BIND(_create_remote, "remote_name", "remote_url");
|
||||
GDVIRTUAL_BIND(_remove_remote, "remote_name");
|
||||
GDVIRTUAL_BIND(_get_current_branch_name);
|
||||
GDVIRTUAL_BIND(_checkout_branch, "branch_name");
|
||||
GDVIRTUAL_BIND(_pull, "remote");
|
||||
GDVIRTUAL_BIND(_push, "remote", "force");
|
||||
GDVIRTUAL_BIND(_fetch, "remote");
|
||||
GDVIRTUAL_BIND(_get_line_diff, "file_path", "text");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("create_diff_line", "new_line_no", "old_line_no", "content", "status"), &EditorVCSInterface::create_diff_line);
|
||||
ClassDB::bind_method(D_METHOD("create_diff_hunk", "old_start", "new_start", "old_lines", "new_lines"), &EditorVCSInterface::create_diff_hunk);
|
||||
ClassDB::bind_method(D_METHOD("create_diff_file", "new_file", "old_file"), &EditorVCSInterface::create_diff_file);
|
||||
ClassDB::bind_method(D_METHOD("create_commit", "msg", "author", "id", "unix_timestamp", "offset_minutes"), &EditorVCSInterface::create_commit);
|
||||
ClassDB::bind_method(D_METHOD("create_status_file", "file_path", "change_type", "area"), &EditorVCSInterface::create_status_file);
|
||||
ClassDB::bind_method(D_METHOD("add_diff_hunks_into_diff_file", "diff_file", "diff_hunks"), &EditorVCSInterface::add_diff_hunks_into_diff_file);
|
||||
ClassDB::bind_method(D_METHOD("add_line_diffs_into_diff_hunk", "diff_hunk", "line_diffs"), &EditorVCSInterface::add_line_diffs_into_diff_hunk);
|
||||
ClassDB::bind_method(D_METHOD("popup_error", "msg"), &EditorVCSInterface::popup_error);
|
||||
|
||||
BIND_ENUM_CONSTANT(CHANGE_TYPE_NEW);
|
||||
BIND_ENUM_CONSTANT(CHANGE_TYPE_MODIFIED);
|
||||
BIND_ENUM_CONSTANT(CHANGE_TYPE_RENAMED);
|
||||
BIND_ENUM_CONSTANT(CHANGE_TYPE_DELETED);
|
||||
BIND_ENUM_CONSTANT(CHANGE_TYPE_TYPECHANGE);
|
||||
BIND_ENUM_CONSTANT(CHANGE_TYPE_UNMERGED);
|
||||
|
||||
BIND_ENUM_CONSTANT(TREE_AREA_COMMIT);
|
||||
BIND_ENUM_CONSTANT(TREE_AREA_STAGED);
|
||||
BIND_ENUM_CONSTANT(TREE_AREA_UNSTAGED);
|
||||
}
|
||||
|
||||
EditorVCSInterface *EditorVCSInterface::get_singleton() {
|
||||
|
@ -170,14 +409,14 @@ void EditorVCSInterface::create_vcs_metadata_files(VCSMetadata p_vcs_metadata_ty
|
|||
if (p_vcs_metadata_type == VCSMetadata::GIT) {
|
||||
Ref<FileAccess> f = FileAccess::open(p_dir.path_join(".gitignore"), FileAccess::WRITE);
|
||||
if (f.is_null()) {
|
||||
ERR_FAIL_MSG(TTR("Couldn't create .gitignore in project path."));
|
||||
ERR_FAIL_MSG("Couldn't create .gitignore in project path.");
|
||||
} else {
|
||||
f->store_line("# Godot 4+ specific ignores");
|
||||
f->store_line(".godot/");
|
||||
}
|
||||
f = FileAccess::open(p_dir.path_join(".gitattributes"), FileAccess::WRITE);
|
||||
if (f.is_null()) {
|
||||
ERR_FAIL_MSG(TTR("Couldn't create .gitattributes in project path."));
|
||||
ERR_FAIL_MSG("Couldn't create .gitattributes in project path.");
|
||||
} else {
|
||||
f->store_line("# Normalize EOL for all files that Git considers text files.");
|
||||
f->store_line("* text=auto eol=lf");
|
||||
|
|
|
@ -32,30 +32,103 @@
|
|||
#define EDITOR_VCS_INTERFACE_H
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/gdvirtual.gen.inc"
|
||||
#include "core/object/script_language_extension.h"
|
||||
#include "core/string/ustring.h"
|
||||
#include "scene/gui/panel_container.h"
|
||||
#include "core/variant/type_info.h"
|
||||
|
||||
class EditorVCSInterface : public Object {
|
||||
GDCLASS(EditorVCSInterface, Object)
|
||||
|
||||
bool is_initialized = false;
|
||||
public:
|
||||
enum ChangeType {
|
||||
CHANGE_TYPE_NEW = 0,
|
||||
CHANGE_TYPE_MODIFIED = 1,
|
||||
CHANGE_TYPE_RENAMED = 2,
|
||||
CHANGE_TYPE_DELETED = 3,
|
||||
CHANGE_TYPE_TYPECHANGE = 4,
|
||||
CHANGE_TYPE_UNMERGED = 5
|
||||
};
|
||||
|
||||
enum TreeArea {
|
||||
TREE_AREA_COMMIT = 0,
|
||||
TREE_AREA_STAGED = 1,
|
||||
TREE_AREA_UNSTAGED = 2
|
||||
};
|
||||
|
||||
struct DiffLine {
|
||||
int new_line_no;
|
||||
int old_line_no;
|
||||
String content;
|
||||
String status;
|
||||
|
||||
String old_text;
|
||||
String new_text;
|
||||
};
|
||||
|
||||
struct DiffHunk {
|
||||
int new_start;
|
||||
int old_start;
|
||||
int new_lines;
|
||||
int old_lines;
|
||||
List<DiffLine> diff_lines;
|
||||
};
|
||||
|
||||
struct DiffFile {
|
||||
String new_file;
|
||||
String old_file;
|
||||
List<DiffHunk> diff_hunks;
|
||||
};
|
||||
|
||||
struct Commit {
|
||||
String author;
|
||||
String msg;
|
||||
String id;
|
||||
int64_t unix_timestamp;
|
||||
int64_t offset_minutes;
|
||||
};
|
||||
|
||||
struct StatusFile {
|
||||
TreeArea area;
|
||||
ChangeType change_type;
|
||||
String file_path;
|
||||
};
|
||||
|
||||
protected:
|
||||
static EditorVCSInterface *singleton;
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
// Implemented by addons as end points for the proxy functions
|
||||
virtual bool _initialize(String p_project_root_path);
|
||||
virtual bool _is_vcs_initialized();
|
||||
virtual Dictionary _get_modified_files_data();
|
||||
virtual void _stage_file(String p_file_path);
|
||||
virtual void _unstage_file(String p_file_path);
|
||||
virtual void _commit(String p_msg);
|
||||
virtual TypedArray<Dictionary> _get_file_diff(String p_file_path);
|
||||
virtual bool _shut_down();
|
||||
virtual String _get_project_name();
|
||||
virtual String _get_vcs_name();
|
||||
DiffLine _convert_diff_line(Dictionary p_diff_line);
|
||||
DiffHunk _convert_diff_hunk(Dictionary p_diff_hunk);
|
||||
DiffFile _convert_diff_file(Dictionary p_diff_file);
|
||||
Commit _convert_commit(Dictionary p_commit);
|
||||
StatusFile _convert_status_file(Dictionary p_status_file);
|
||||
|
||||
// Proxy endpoints for extensions to implement
|
||||
GDVIRTUAL1R(bool, _initialize, String);
|
||||
GDVIRTUAL5(_set_credentials, String, String, String, String, String);
|
||||
GDVIRTUAL0R(Array, _get_modified_files_data);
|
||||
GDVIRTUAL1(_stage_file, String);
|
||||
GDVIRTUAL1(_unstage_file, String);
|
||||
GDVIRTUAL1(_discard_file, String);
|
||||
GDVIRTUAL1(_commit, String);
|
||||
GDVIRTUAL2R(TypedArray<Dictionary>, _get_diff, String, int);
|
||||
GDVIRTUAL0R(bool, _shut_down);
|
||||
GDVIRTUAL0R(String, _get_vcs_name);
|
||||
GDVIRTUAL1R(Array, _get_previous_commits, int);
|
||||
GDVIRTUAL0R(Array, _get_branch_list);
|
||||
GDVIRTUAL0R(Array, _get_remotes);
|
||||
GDVIRTUAL1(_create_branch, String);
|
||||
GDVIRTUAL1(_remove_branch, String);
|
||||
GDVIRTUAL2(_create_remote, String, String);
|
||||
GDVIRTUAL1(_remove_remote, String);
|
||||
GDVIRTUAL0R(String, _get_current_branch_name);
|
||||
GDVIRTUAL1R(bool, _checkout_branch, String);
|
||||
GDVIRTUAL1(_pull, String);
|
||||
GDVIRTUAL2(_push, String, bool);
|
||||
GDVIRTUAL1(_fetch, String);
|
||||
GDVIRTUAL2R(Array, _get_line_diff, String, String);
|
||||
|
||||
public:
|
||||
static EditorVCSInterface *get_singleton();
|
||||
|
@ -67,22 +140,44 @@ public:
|
|||
};
|
||||
static void create_vcs_metadata_files(VCSMetadata p_vcs_metadata_type, String &p_dir);
|
||||
|
||||
bool is_addon_ready();
|
||||
|
||||
// Proxy functions to the editor for use
|
||||
bool initialize(String p_project_root_path);
|
||||
bool is_vcs_initialized();
|
||||
Dictionary get_modified_files_data();
|
||||
// Proxies to the editor for use
|
||||
bool initialize(String p_project_path);
|
||||
void set_credentials(String p_username, String p_password, String p_ssh_public_key_path, String p_ssh_private_key_path, String p_ssh_passphrase);
|
||||
List<StatusFile> get_modified_files_data();
|
||||
void stage_file(String p_file_path);
|
||||
void unstage_file(String p_file_path);
|
||||
void discard_file(String p_file_path);
|
||||
void commit(String p_msg);
|
||||
TypedArray<Dictionary> get_file_diff(String p_file_path);
|
||||
List<DiffFile> get_diff(String p_identifier, TreeArea p_area);
|
||||
bool shut_down();
|
||||
String get_project_name();
|
||||
String get_vcs_name();
|
||||
List<Commit> get_previous_commits(int p_max_commits);
|
||||
List<String> get_branch_list();
|
||||
List<String> get_remotes();
|
||||
void create_branch(String p_branch_name);
|
||||
void remove_branch(String p_branch_name);
|
||||
void create_remote(String p_remote_name, String p_remote_url);
|
||||
void remove_remote(String p_remote_name);
|
||||
String get_current_branch_name();
|
||||
bool checkout_branch(String p_branch_name);
|
||||
void pull(String p_remote);
|
||||
void push(String p_remote, bool p_force);
|
||||
void fetch(String p_remote);
|
||||
List<DiffHunk> get_line_diff(String p_file_path, String p_text);
|
||||
|
||||
EditorVCSInterface();
|
||||
virtual ~EditorVCSInterface();
|
||||
// Helper functions to create and convert Dictionary into data structures
|
||||
Dictionary create_diff_line(int p_new_line_no, int p_old_line_no, String p_content, String p_status);
|
||||
Dictionary create_diff_hunk(int p_old_start, int p_new_start, int p_old_lines, int p_new_lines);
|
||||
Dictionary create_diff_file(String p_new_file, String p_old_file);
|
||||
Dictionary create_commit(String p_msg, String p_author, String p_id, int64_t p_unix_timestamp, int64_t p_offset_minutes);
|
||||
Dictionary create_status_file(String p_file_path, ChangeType p_change, TreeArea p_area);
|
||||
Dictionary add_line_diffs_into_diff_hunk(Dictionary p_diff_hunk, Array p_line_diffs);
|
||||
Dictionary add_diff_hunks_into_diff_file(Dictionary p_diff_file, Array p_diff_hunks);
|
||||
|
||||
void popup_error(String p_msg);
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(EditorVCSInterface::ChangeType);
|
||||
VARIANT_ENUM_CAST(EditorVCSInterface::TreeArea);
|
||||
|
||||
#endif // EDITOR_VCS_INTERFACE_H
|
||||
|
|
1
editor/icons/VcsBranches.svg
Normal file
1
editor/icons/VcsBranches.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="1.5" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0" fill-rule="nonzero"><path d="m3.755 1.396c-1.599 0-2.914 1.315-2.914 2.913 0 1.599 1.315 2.914 2.914 2.914 1.598 0 2.913-1.315 2.913-2.914 0-1.598-1.315-2.913-2.913-2.913zm0 1.462c.796 0 1.451.655 1.451 1.451 0 .797-.655 1.452-1.451 1.452-.797 0-1.452-.655-1.452-1.452 0-.796.655-1.451 1.452-1.451z"/><path d="m12.073 8.956c-1.599 0-2.914 1.316-2.914 2.914s1.315 2.914 2.914 2.914c1.598 0 2.914-1.316 2.914-2.914s-1.316-2.914-2.914-2.914zm0 1.463c.796 0 1.451.655 1.451 1.451s-.655 1.451-1.451 1.451-1.451-.655-1.451-1.451.655-1.451 1.451-1.451z"/><path d="m12.073 1.396c-1.599 0-2.914 1.315-2.914 2.913 0 1.599 1.315 2.914 2.914 2.914 1.598 0 2.914-1.315 2.914-2.914 0-1.598-1.316-2.913-2.914-2.913zm0 1.462c.796 0 1.451.655 1.451 1.451 0 .797-.655 1.452-1.451 1.452s-1.451-.655-1.451-1.452c0-.796.655-1.451 1.451-1.451z"/></g><path d="m9.159 11.87h-2.491l-2.913-2.914v-1.733" fill="none" stroke="#e0e0e0" stroke-width="1.5"/><path d="m9.159 4.309h-2.491" fill="none" stroke="#e0e0e0" stroke-width="1.5"/></svg>
|
After Width: | Height: | Size: 1.2 KiB |
|
@ -940,50 +940,6 @@ void ScriptEditor::_resave_scripts(const String &p_str) {
|
|||
disk_changed->hide();
|
||||
}
|
||||
|
||||
void ScriptEditor::_reload_scripts() {
|
||||
for (int i = 0; i < tab_container->get_tab_count(); i++) {
|
||||
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
|
||||
if (!se) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Ref<Resource> edited_res = se->get_edited_resource();
|
||||
|
||||
if (edited_res->is_built_in()) {
|
||||
continue; //internal script, who cares
|
||||
}
|
||||
|
||||
uint64_t last_date = edited_res->get_last_modified_time();
|
||||
uint64_t date = FileAccess::get_modified_time(edited_res->get_path());
|
||||
|
||||
if (last_date == date) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Ref<Script> script = edited_res;
|
||||
if (script != nullptr) {
|
||||
Ref<Script> rel_script = ResourceLoader::load(script->get_path(), script->get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
|
||||
ERR_CONTINUE(!rel_script.is_valid());
|
||||
script->set_source_code(rel_script->get_source_code());
|
||||
script->set_last_modified_time(rel_script->get_last_modified_time());
|
||||
script->reload(true);
|
||||
}
|
||||
|
||||
Ref<TextFile> text_file = edited_res;
|
||||
if (text_file != nullptr) {
|
||||
Error err;
|
||||
Ref<TextFile> rel_text_file = _load_text_file(text_file->get_path(), &err);
|
||||
ERR_CONTINUE(!rel_text_file.is_valid());
|
||||
text_file->set_text(rel_text_file->get_text());
|
||||
text_file->set_last_modified_time(rel_text_file->get_last_modified_time());
|
||||
}
|
||||
se->reload_text();
|
||||
}
|
||||
|
||||
disk_changed->hide();
|
||||
_update_script_names();
|
||||
}
|
||||
|
||||
void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) {
|
||||
for (int i = 0; i < tab_container->get_tab_count(); i++) {
|
||||
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
|
||||
|
@ -1077,7 +1033,7 @@ bool ScriptEditor::_test_script_times_on_disk(Ref<Resource> p_for_script) {
|
|||
|
||||
if (need_reload) {
|
||||
if (!need_ask) {
|
||||
script_editor->_reload_scripts();
|
||||
script_editor->reload_scripts();
|
||||
need_reload = false;
|
||||
} else {
|
||||
disk_changed->call_deferred(SNAME("popup_centered_ratio"), 0.5);
|
||||
|
@ -2588,6 +2544,50 @@ void ScriptEditor::apply_scripts() const {
|
|||
}
|
||||
}
|
||||
|
||||
void ScriptEditor::reload_scripts() {
|
||||
for (int i = 0; i < tab_container->get_tab_count(); i++) {
|
||||
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
|
||||
if (!se) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Ref<Resource> edited_res = se->get_edited_resource();
|
||||
|
||||
if (edited_res->is_built_in()) {
|
||||
continue; //internal script, who cares
|
||||
}
|
||||
|
||||
uint64_t last_date = edited_res->get_last_modified_time();
|
||||
uint64_t date = FileAccess::get_modified_time(edited_res->get_path());
|
||||
|
||||
if (last_date == date) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Ref<Script> script = edited_res;
|
||||
if (script != nullptr) {
|
||||
Ref<Script> rel_script = ResourceLoader::load(script->get_path(), script->get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
|
||||
ERR_CONTINUE(!rel_script.is_valid());
|
||||
script->set_source_code(rel_script->get_source_code());
|
||||
script->set_last_modified_time(rel_script->get_last_modified_time());
|
||||
script->reload(true);
|
||||
}
|
||||
|
||||
Ref<TextFile> text_file = edited_res;
|
||||
if (text_file != nullptr) {
|
||||
Error err;
|
||||
Ref<TextFile> rel_text_file = _load_text_file(text_file->get_path(), &err);
|
||||
ERR_CONTINUE(!rel_text_file.is_valid());
|
||||
text_file->set_text(rel_text_file->get_text());
|
||||
text_file->set_last_modified_time(rel_text_file->get_last_modified_time());
|
||||
}
|
||||
se->reload_text();
|
||||
}
|
||||
|
||||
disk_changed->hide();
|
||||
_update_script_names();
|
||||
}
|
||||
|
||||
void ScriptEditor::open_script_create_dialog(const String &p_base_name, const String &p_base_path) {
|
||||
_menu_option(FILE_NEW);
|
||||
script_create_dialog->config(p_base_name, p_base_path);
|
||||
|
@ -3918,7 +3918,7 @@ ScriptEditor::ScriptEditor() {
|
|||
vbc->add_child(disk_changed_list);
|
||||
disk_changed_list->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
|
||||
disk_changed->connect("confirmed", callable_mp(this, &ScriptEditor::_reload_scripts));
|
||||
disk_changed->connect("confirmed", callable_mp(this, &ScriptEditor::reload_scripts));
|
||||
disk_changed->set_ok_button_text(TTR("Reload"));
|
||||
|
||||
disk_changed->add_button(TTR("Resave"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "resave");
|
||||
|
|
|
@ -327,7 +327,6 @@ class ScriptEditor : public PanelContainer {
|
|||
String _get_debug_tooltip(const String &p_text, Node *_se);
|
||||
|
||||
void _resave_scripts(const String &p_str);
|
||||
void _reload_scripts();
|
||||
|
||||
bool _test_script_times_on_disk(Ref<Resource> p_for_script = Ref<Resource>());
|
||||
|
||||
|
@ -478,6 +477,7 @@ public:
|
|||
bool toggle_scripts_panel();
|
||||
bool is_scripts_panel_toggled();
|
||||
void apply_scripts() const;
|
||||
void reload_scripts();
|
||||
void open_script_create_dialog(const String &p_base_name, const String &p_base_path);
|
||||
void open_text_file_create_dialog(const String &p_base_path, const String &p_base_name = "");
|
||||
Ref<Resource> open_file(const String &p_file);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -33,9 +33,12 @@
|
|||
|
||||
#include "editor/editor_plugin.h"
|
||||
#include "editor/editor_vcs_interface.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "scene/gui/check_button.h"
|
||||
#include "scene/gui/container.h"
|
||||
#include "scene/gui/file_dialog.h"
|
||||
#include "scene/gui/menu_button.h"
|
||||
#include "scene/gui/rich_text_label.h"
|
||||
#include "scene/gui/split_container.h"
|
||||
#include "scene/gui/tab_container.h"
|
||||
#include "scene/gui/text_edit.h"
|
||||
#include "scene/gui/tree.h"
|
||||
|
||||
|
@ -43,79 +46,154 @@ class VersionControlEditorPlugin : public EditorPlugin {
|
|||
GDCLASS(VersionControlEditorPlugin, EditorPlugin)
|
||||
|
||||
public:
|
||||
enum ChangeType {
|
||||
CHANGE_TYPE_NEW = 0,
|
||||
CHANGE_TYPE_MODIFIED = 1,
|
||||
CHANGE_TYPE_RENAMED = 2,
|
||||
CHANGE_TYPE_DELETED = 3,
|
||||
CHANGE_TYPE_TYPECHANGE = 4
|
||||
enum ButtonType {
|
||||
BUTTON_TYPE_OPEN = 0,
|
||||
BUTTON_TYPE_DISCARD = 1,
|
||||
};
|
||||
|
||||
enum DiffViewType {
|
||||
DIFF_VIEW_TYPE_SPLIT = 0,
|
||||
DIFF_VIEW_TYPE_UNIFIED = 1,
|
||||
};
|
||||
|
||||
enum ExtraOption {
|
||||
EXTRA_OPTION_FORCE_PUSH,
|
||||
EXTRA_OPTION_CREATE_BRANCH,
|
||||
EXTRA_OPTION_CREATE_REMOTE,
|
||||
};
|
||||
|
||||
private:
|
||||
static VersionControlEditorPlugin *singleton;
|
||||
|
||||
int staged_files_count;
|
||||
List<StringName> available_addons;
|
||||
List<StringName> available_plugins;
|
||||
|
||||
PopupMenu *version_control_actions = nullptr;
|
||||
ConfirmationDialog *metadata_dialog = nullptr;
|
||||
OptionButton *metadata_selection = nullptr;
|
||||
AcceptDialog *set_up_dialog = nullptr;
|
||||
VBoxContainer *set_up_vbc = nullptr;
|
||||
HBoxContainer *set_up_hbc = nullptr;
|
||||
Label *set_up_vcs_label = nullptr;
|
||||
CheckButton *toggle_vcs_choice = nullptr;
|
||||
OptionButton *set_up_choice = nullptr;
|
||||
PanelContainer *set_up_init_settings = nullptr;
|
||||
Button *set_up_init_button = nullptr;
|
||||
RichTextLabel *set_up_vcs_status = nullptr;
|
||||
Button *set_up_ok_button = nullptr;
|
||||
LineEdit *project_path_input = nullptr;
|
||||
Button *select_project_path_button = nullptr;
|
||||
VBoxContainer *set_up_vbc = nullptr;
|
||||
VBoxContainer *set_up_settings_vbc = nullptr;
|
||||
LineEdit *set_up_username = nullptr;
|
||||
LineEdit *set_up_password = nullptr;
|
||||
LineEdit *set_up_ssh_public_key_path = nullptr;
|
||||
LineEdit *set_up_ssh_private_key_path = nullptr;
|
||||
LineEdit *set_up_ssh_passphrase = nullptr;
|
||||
FileDialog *set_up_ssh_public_key_file_dialog = nullptr;
|
||||
FileDialog *set_up_ssh_private_key_file_dialog = nullptr;
|
||||
Label *set_up_warning_text = nullptr;
|
||||
|
||||
HashMap<ChangeType, String> change_type_to_strings;
|
||||
HashMap<ChangeType, Color> change_type_to_color;
|
||||
OptionButton *commit_list_size_button = nullptr;
|
||||
|
||||
AcceptDialog *branch_create_confirm = nullptr;
|
||||
LineEdit *branch_create_name_input = nullptr;
|
||||
Button *branch_create_ok = nullptr;
|
||||
|
||||
AcceptDialog *remote_create_confirm = nullptr;
|
||||
LineEdit *remote_create_name_input = nullptr;
|
||||
LineEdit *remote_create_url_input = nullptr;
|
||||
Button *remote_create_ok = nullptr;
|
||||
|
||||
HashMap<EditorVCSInterface::ChangeType, String> change_type_to_strings;
|
||||
HashMap<EditorVCSInterface::ChangeType, Color> change_type_to_color;
|
||||
HashMap<EditorVCSInterface::ChangeType, Ref<Texture>> change_type_to_icon;
|
||||
|
||||
VBoxContainer *version_commit_dock = nullptr;
|
||||
VBoxContainer *commit_box_vbc = nullptr;
|
||||
HSplitContainer *stage_tools = nullptr;
|
||||
Tree *stage_files = nullptr;
|
||||
TreeItem *new_files = nullptr;
|
||||
TreeItem *modified_files = nullptr;
|
||||
TreeItem *renamed_files = nullptr;
|
||||
TreeItem *deleted_files = nullptr;
|
||||
TreeItem *typechange_files = nullptr;
|
||||
Label *staging_area_label = nullptr;
|
||||
HSplitContainer *stage_buttons = nullptr;
|
||||
Tree *staged_files = nullptr;
|
||||
Tree *unstaged_files = nullptr;
|
||||
Tree *commit_list = nullptr;
|
||||
|
||||
OptionButton *branch_select = nullptr;
|
||||
Button *branch_remove_button = nullptr;
|
||||
AcceptDialog *branch_remove_confirm = nullptr;
|
||||
|
||||
Button *fetch_button = nullptr;
|
||||
Button *pull_button = nullptr;
|
||||
Button *push_button = nullptr;
|
||||
OptionButton *remote_select = nullptr;
|
||||
Button *remote_remove_button = nullptr;
|
||||
AcceptDialog *remote_remove_confirm = nullptr;
|
||||
MenuButton *extra_options = nullptr;
|
||||
PopupMenu *extra_options_remove_branch_list = nullptr;
|
||||
PopupMenu *extra_options_remove_remote_list = nullptr;
|
||||
|
||||
String branch_to_remove;
|
||||
String remote_to_remove;
|
||||
|
||||
Button *stage_all_button = nullptr;
|
||||
Button *stage_selected_button = nullptr;
|
||||
Button *unstage_all_button = nullptr;
|
||||
Button *discard_all_button = nullptr;
|
||||
Button *refresh_button = nullptr;
|
||||
TextEdit *commit_message = nullptr;
|
||||
Button *commit_button = nullptr;
|
||||
Label *commit_status = nullptr;
|
||||
|
||||
PanelContainer *version_control_dock = nullptr;
|
||||
VBoxContainer *version_control_dock = nullptr;
|
||||
Button *version_control_dock_button = nullptr;
|
||||
VBoxContainer *diff_vbc = nullptr;
|
||||
HBoxContainer *diff_hbc = nullptr;
|
||||
Button *diff_refresh_button = nullptr;
|
||||
Label *diff_file_name = nullptr;
|
||||
Label *diff_heading = nullptr;
|
||||
Label *diff_title = nullptr;
|
||||
RichTextLabel *diff = nullptr;
|
||||
OptionButton *diff_view_type_select = nullptr;
|
||||
bool show_commit_diff_header = false;
|
||||
List<EditorVCSInterface::DiffFile> diff_content;
|
||||
|
||||
void _populate_available_vcs_names();
|
||||
void _create_vcs_metadata_files();
|
||||
void _selected_a_vcs(int p_id);
|
||||
void _notification(int p_what);
|
||||
void _initialize_vcs();
|
||||
void _send_commit_msg();
|
||||
void _set_vcs_ui_state(bool p_enabled);
|
||||
void _set_credentials();
|
||||
void _ssh_public_key_selected(String p_path);
|
||||
void _ssh_private_key_selected(String p_path);
|
||||
void _populate_available_vcs_names();
|
||||
void _update_remotes_list();
|
||||
void _update_set_up_warning(String p_new_text);
|
||||
void _update_opened_tabs();
|
||||
void _update_extra_options();
|
||||
|
||||
bool _load_plugin(String p_name, String p_project_path);
|
||||
|
||||
void _pull();
|
||||
void _push();
|
||||
void _force_push();
|
||||
void _fetch();
|
||||
void _commit();
|
||||
void _discard_all();
|
||||
void _refresh_stage_area();
|
||||
void _stage_selected();
|
||||
void _stage_all();
|
||||
void _view_file_diff();
|
||||
void _display_file_diff(String p_file_path);
|
||||
void _refresh_file_diff();
|
||||
void _clear_file_diff();
|
||||
void _update_stage_status();
|
||||
void _update_commit_status();
|
||||
void _refresh_branch_list();
|
||||
void _set_commit_list_size(int p_index);
|
||||
void _refresh_commit_list();
|
||||
void _refresh_remote_list();
|
||||
void _display_diff(int p_idx);
|
||||
void _move_all(Object *p_tree);
|
||||
void _load_diff(Object *p_tree);
|
||||
void _clear_diff();
|
||||
int _get_item_count(Tree *p_tree);
|
||||
void _item_activated(Object *p_tree);
|
||||
void _create_branch();
|
||||
void _create_remote();
|
||||
void _update_branch_create_button(String p_new_text);
|
||||
void _update_remote_create_button(String p_new_text);
|
||||
void _branch_item_selected(int p_index);
|
||||
void _remote_selected(int p_index);
|
||||
void _remove_branch();
|
||||
void _remove_remote();
|
||||
void _popup_branch_remove_confirm(int p_index);
|
||||
void _popup_remote_remove_confirm(int p_index);
|
||||
void _move_item(Tree *p_tree, TreeItem *p_itme);
|
||||
void _display_diff_split_view(List<EditorVCSInterface::DiffLine> &p_diff_content);
|
||||
void _display_diff_unified_view(List<EditorVCSInterface::DiffLine> &p_diff_content);
|
||||
void _discard_file(String p_file_path, EditorVCSInterface::ChangeType p_change);
|
||||
void _cell_button_pressed(Object *p_item, int p_column, int p_id, int p_mouse_button_index);
|
||||
void _add_new_item(Tree *p_tree, String p_file_path, EditorVCSInterface::ChangeType p_change);
|
||||
void _update_commit_button();
|
||||
void _commit_message_gui_input(const Ref<InputEvent> &p_event);
|
||||
void _extra_option_selected(int p_index);
|
||||
bool _is_staging_area_empty();
|
||||
String _get_date_string_from(int64_t p_unix_timestamp, int64_t p_offset_minutes) const;
|
||||
void _create_vcs_metadata_files();
|
||||
void _popup_file_dialog(Variant p_file_dialog_variant);
|
||||
void _toggle_vcs_integration(bool p_toggled);
|
||||
void _project_path_selected(String p_project_path);
|
||||
|
||||
friend class EditorVCSInterface;
|
||||
|
||||
|
@ -127,25 +205,15 @@ public:
|
|||
|
||||
void popup_vcs_metadata_dialog();
|
||||
void popup_vcs_set_up_dialog(const Control *p_gui_base);
|
||||
void set_version_control_tool_button(Button *p_button) { version_control_dock_button = p_button; }
|
||||
|
||||
PopupMenu *get_version_control_actions_panel() const { return version_control_actions; }
|
||||
VBoxContainer *get_version_commit_dock() const { return version_commit_dock; }
|
||||
PanelContainer *get_version_control_dock() const { return version_control_dock; }
|
||||
|
||||
List<StringName> get_available_vcs_names() const { return available_addons; }
|
||||
bool is_vcs_initialized() const;
|
||||
const String get_vcs_name() const;
|
||||
|
||||
void register_editor();
|
||||
void fetch_available_vcs_addon_names();
|
||||
void clear_stage_area();
|
||||
void fetch_available_vcs_plugin_names();
|
||||
void shut_down();
|
||||
|
||||
VersionControlEditorPlugin();
|
||||
~VersionControlEditorPlugin();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(VersionControlEditorPlugin::ChangeType);
|
||||
|
||||
#endif // VERSION_CONTROL_EDITOR_PLUGIN_H
|
||||
|
|
Loading…
Reference in a new issue