mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-13 22:31:11 +01:00
Removed the VCS plugin.
This commit is contained in:
parent
24e5d5cb34
commit
7acd98dcf0
@ -152,7 +152,6 @@
|
||||
#include "editor/plugins/theme_editor_plugin.h"
|
||||
#include "editor/plugins/tile_map_editor_plugin.h"
|
||||
#include "editor/plugins/tile_set_editor_plugin.h"
|
||||
#include "editor/plugins/version_control_editor_plugin.h"
|
||||
#include "editor/plugins/viewport_preview_editor_plugin.h"
|
||||
#include "editor/progress_dialog.h"
|
||||
#include "editor/project_export.h"
|
||||
@ -338,17 +337,6 @@ void EditorNode::_update_scene_tabs() {
|
||||
}
|
||||
}
|
||||
|
||||
void EditorNode::_version_control_menu_option(int p_idx) {
|
||||
switch (vcs_actions_menu->get_item_id(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;
|
||||
}
|
||||
}
|
||||
|
||||
void EditorNode::_update_title() {
|
||||
const String appname = ProjectSettings::get_singleton()->get("application/config/name");
|
||||
String title = (appname.empty() ? "Unnamed Project" : appname) + String(" - ") + VERSION_NAME;
|
||||
@ -3766,7 +3754,6 @@ void EditorNode::register_editor_types() {
|
||||
ClassDB::register_class<EditorResourcePreviewGenerator>();
|
||||
ClassDB::register_virtual_class<EditorFileSystem>();
|
||||
ClassDB::register_class<EditorFileSystemDirectory>();
|
||||
ClassDB::register_class<EditorVCSInterface>();
|
||||
ClassDB::register_virtual_class<ScriptEditor>();
|
||||
ClassDB::register_virtual_class<EditorInterface>();
|
||||
ClassDB::register_class<EditorExportPlugin>();
|
||||
@ -5538,7 +5525,6 @@ void EditorNode::_bind_methods() {
|
||||
ClassDB::bind_method("_dropped_files", &EditorNode::_dropped_files);
|
||||
ClassDB::bind_method(D_METHOD("_global_menu_action"), &EditorNode::_global_menu_action, DEFVAL(Variant()));
|
||||
ClassDB::bind_method("_toggle_distraction_free_mode", &EditorNode::_toggle_distraction_free_mode);
|
||||
ClassDB::bind_method("_version_control_menu_option", &EditorNode::_version_control_menu_option);
|
||||
ClassDB::bind_method("edit_item_resource", &EditorNode::edit_item_resource);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_gui_base"), &EditorNode::get_gui_base);
|
||||
@ -6199,15 +6185,6 @@ EditorNode::EditorNode() {
|
||||
p->add_shortcut(ED_SHORTCUT("editor/project_settings", TTR("Project Settings...")), RUN_SETTINGS);
|
||||
p->connect("id_pressed", this, "_menu_option");
|
||||
|
||||
vcs_actions_menu = VersionControlEditorPlugin::get_singleton()->get_version_control_actions_panel();
|
||||
vcs_actions_menu->set_name("Version Control");
|
||||
vcs_actions_menu->connect("index_pressed", this, "_version_control_menu_option");
|
||||
p->add_separator();
|
||||
p->add_child(vcs_actions_menu);
|
||||
p->add_submenu_item(TTR("Version Control"), "Version Control");
|
||||
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);
|
||||
|
||||
p->add_separator();
|
||||
p->add_shortcut(ED_SHORTCUT("editor/export", TTR("Export...")), FILE_EXPORT_PROJECT);
|
||||
p->add_item(TTR("Install Android Build Template..."), FILE_INSTALL_ANDROID_SOURCE);
|
||||
@ -6758,7 +6735,6 @@ EditorNode::EditorNode() {
|
||||
//more visually meaningful to have this later
|
||||
raise_bottom_panel_item(AnimationPlayerEditor::singleton);
|
||||
|
||||
add_editor_plugin(VersionControlEditorPlugin::get_singleton());
|
||||
add_editor_plugin(memnew(ShaderEditorPlugin(this)));
|
||||
|
||||
add_editor_plugin(memnew(CameraEditorPlugin(this)));
|
||||
|
@ -171,8 +171,6 @@ private:
|
||||
RUN_DEBUG_SHADER_FALLBACKS,
|
||||
RUN_DEPLOY_REMOTE_DEBUG,
|
||||
RUN_RELOAD_SCRIPTS,
|
||||
RUN_VCS_SETTINGS,
|
||||
RUN_VCS_SHUT_DOWN,
|
||||
SETTINGS_UPDATE_CONTINUOUSLY,
|
||||
SETTINGS_UPDATE_VITAL_ONLY,
|
||||
SETTINGS_UPDATE_WHEN_CHANGED,
|
||||
@ -331,7 +329,6 @@ private:
|
||||
EditorSettingsDialog *settings_config_dialog;
|
||||
RunSettingsDialog *run_settings_dialog;
|
||||
ProjectSettingsEditor *project_settings;
|
||||
PopupMenu *vcs_actions_menu;
|
||||
EditorFileDialog *file;
|
||||
ExportTemplateManager *export_template_manager;
|
||||
EditorFileDialog *file_templates;
|
||||
@ -489,7 +486,6 @@ private:
|
||||
void _get_scene_metadata(const String &p_file);
|
||||
void _update_title();
|
||||
void _update_scene_tabs();
|
||||
void _version_control_menu_option(int p_idx);
|
||||
void _close_messages();
|
||||
void _show_messages();
|
||||
void _vp_resized();
|
||||
|
@ -1,336 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* editor_vcs_interface.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "editor_vcs_interface.h"
|
||||
|
||||
#include "editor_node.h"
|
||||
|
||||
EditorVCSInterface *EditorVCSInterface::singleton = nullptr;
|
||||
|
||||
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_path) {
|
||||
return call("_initialize", p_project_path);
|
||||
}
|
||||
|
||||
void EditorVCSInterface::set_credentials(String p_username, String p_password, String p_ssh_public_key, String p_ssh_private_key, String p_ssh_passphrase) {
|
||||
call("_set_credentials", p_username, p_password, p_ssh_public_key, p_ssh_private_key, p_ssh_passphrase);
|
||||
}
|
||||
|
||||
List<String> EditorVCSInterface::get_remotes() {
|
||||
List<String> remotes;
|
||||
|
||||
Array result = call("_get_remotes");
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
remotes.push_back(result[i]);
|
||||
}
|
||||
|
||||
return remotes;
|
||||
}
|
||||
|
||||
List<EditorVCSInterface::StatusFile> EditorVCSInterface::get_modified_files_data() {
|
||||
List<EditorVCSInterface::StatusFile> status_files;
|
||||
|
||||
Array result = call("_get_modified_files_data");
|
||||
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) {
|
||||
call("_stage_file", p_file_path);
|
||||
}
|
||||
|
||||
void EditorVCSInterface::unstage_file(String p_file_path) {
|
||||
call("_unstage_file", p_file_path);
|
||||
}
|
||||
|
||||
void EditorVCSInterface::discard_file(String p_file_path) {
|
||||
call("_discard_file", p_file_path);
|
||||
}
|
||||
|
||||
void EditorVCSInterface::commit(String p_msg) {
|
||||
call("_commit", p_msg);
|
||||
}
|
||||
|
||||
List<EditorVCSInterface::DiffFile> EditorVCSInterface::get_diff(String p_identifier, TreeArea p_area) {
|
||||
List<DiffFile> diff_files;
|
||||
|
||||
Array result = call("_get_diff", p_identifier, p_area);
|
||||
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) {
|
||||
List<EditorVCSInterface::Commit> commits;
|
||||
|
||||
Array result = call("_get_previous_commits", p_max_commits);
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
commits.push_back(_convert_commit(result[i]));
|
||||
}
|
||||
|
||||
return commits;
|
||||
}
|
||||
|
||||
List<String> EditorVCSInterface::get_branch_list() {
|
||||
List<String> branch_list;
|
||||
|
||||
Array result = call("_get_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) {
|
||||
call("_create_branch", p_branch_name);
|
||||
}
|
||||
|
||||
void EditorVCSInterface::create_remote(String p_remote_name, String p_remote_url) {
|
||||
call("_create_remote", p_remote_name, p_remote_url);
|
||||
}
|
||||
|
||||
void EditorVCSInterface::remove_branch(String p_branch_name) {
|
||||
call("_remove_branch", p_branch_name);
|
||||
}
|
||||
|
||||
void EditorVCSInterface::remove_remote(String p_remote_name) {
|
||||
call("_remove_remote", p_remote_name);
|
||||
}
|
||||
|
||||
String EditorVCSInterface::get_current_branch_name() {
|
||||
return call("_get_current_branch_name");
|
||||
}
|
||||
|
||||
bool EditorVCSInterface::checkout_branch(String p_branch_name) {
|
||||
return call("_checkout_branch", p_branch_name);
|
||||
}
|
||||
|
||||
void EditorVCSInterface::pull(String p_remote) {
|
||||
call("_pull", p_remote);
|
||||
}
|
||||
|
||||
void EditorVCSInterface::push(String p_remote, bool p_force) {
|
||||
call("_push", p_remote, p_force);
|
||||
}
|
||||
|
||||
void EditorVCSInterface::fetch(String p_remote) {
|
||||
call("_fetch", p_remote);
|
||||
}
|
||||
|
||||
List<EditorVCSInterface::DiffHunk> EditorVCSInterface::get_line_diff(String p_file_path, String p_text) {
|
||||
List<DiffHunk> diff_hunks;
|
||||
|
||||
Array result = call("_get_line_diff", p_file_path, p_text);
|
||||
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_vcs_name() {
|
||||
return call("_get_vcs_name");
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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, String p_date) {
|
||||
Dictionary commit_info;
|
||||
commit_info["message"] = p_msg;
|
||||
commit_info["author"] = p_author;
|
||||
commit_info["date"] = p_date;
|
||||
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.date = p_commit["date"];
|
||||
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.
|
||||
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_initialize", PropertyInfo(Variant::STRING, "project_path")));
|
||||
BIND_VMETHOD(MethodInfo("_set_credentials", PropertyInfo(Variant::STRING, "username"), PropertyInfo(Variant::STRING, "password"), PropertyInfo(Variant::STRING, "ssh_public_key_path"), PropertyInfo(Variant::STRING, "ssh_private_key_path"), PropertyInfo(Variant::STRING, "ssh_passphrase")));
|
||||
BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_remotes"));
|
||||
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_vcs_name"));
|
||||
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_shut_down"));
|
||||
BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_modified_files_data"));
|
||||
BIND_VMETHOD(MethodInfo("_commit", PropertyInfo(Variant::STRING, "msg")));
|
||||
BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_diff", PropertyInfo(Variant::STRING, "identifier"), PropertyInfo(Variant::INT, "area")));
|
||||
BIND_VMETHOD(MethodInfo("_stage_file", PropertyInfo(Variant::STRING, "file_path")));
|
||||
BIND_VMETHOD(MethodInfo("_unstage_file", PropertyInfo(Variant::STRING, "file_path")));
|
||||
BIND_VMETHOD(MethodInfo("_discard_file", PropertyInfo(Variant::STRING, "file_path")));
|
||||
BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_previous_commits", PropertyInfo(Variant::INT, "max_commits")));
|
||||
BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_branch_list"));
|
||||
BIND_VMETHOD(MethodInfo("_create_branch", PropertyInfo(Variant::STRING, "branch_name")));
|
||||
BIND_VMETHOD(MethodInfo("_remove_branch", PropertyInfo(Variant::STRING, "branch_name")));
|
||||
BIND_VMETHOD(MethodInfo("_create_remote", PropertyInfo(Variant::STRING, "remote_name"), PropertyInfo(Variant::STRING, "remote_url")));
|
||||
BIND_VMETHOD(MethodInfo("_remove_remote", PropertyInfo(Variant::STRING, "remote_name")));
|
||||
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_current_branch_name"));
|
||||
BIND_VMETHOD(MethodInfo(Variant::BOOL, "_checkout_branch", PropertyInfo(Variant::STRING, "branch_name")));
|
||||
BIND_VMETHOD(MethodInfo("_push", PropertyInfo(Variant::STRING, "remote"), PropertyInfo(Variant::BOOL, "force")));
|
||||
BIND_VMETHOD(MethodInfo("_pull", PropertyInfo(Variant::STRING, "remote")));
|
||||
BIND_VMETHOD(MethodInfo("_fetch", PropertyInfo(Variant::STRING, "remote")));
|
||||
BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_line_diff", PropertyInfo(Variant::STRING, "file_path"), PropertyInfo(Variant::STRING, "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", "date"), &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() {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
void EditorVCSInterface::set_singleton(EditorVCSInterface *p_singleton) {
|
||||
singleton = p_singleton;
|
||||
}
|
@ -1,149 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* editor_vcs_interface.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef EDITOR_VCS_INTERFACE_H
|
||||
#define EDITOR_VCS_INTERFACE_H
|
||||
|
||||
#include "core/object.h"
|
||||
#include "core/ustring.h"
|
||||
#include "scene/gui/panel_container.h"
|
||||
|
||||
class EditorVCSInterface : public Object {
|
||||
GDCLASS(EditorVCSInterface, Object)
|
||||
|
||||
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;
|
||||
String date;
|
||||
};
|
||||
|
||||
struct StatusFile {
|
||||
TreeArea area;
|
||||
ChangeType change_type;
|
||||
String file_path;
|
||||
};
|
||||
|
||||
protected:
|
||||
static EditorVCSInterface *singleton;
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
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);
|
||||
|
||||
public:
|
||||
static EditorVCSInterface *get_singleton();
|
||||
static void set_singleton(EditorVCSInterface *p_singleton);
|
||||
|
||||
// Proxy functions 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);
|
||||
List<DiffFile> get_diff(String p_identifier, TreeArea p_area);
|
||||
bool shut_down();
|
||||
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);
|
||||
|
||||
// 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, String p_date);
|
||||
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
|
File diff suppressed because it is too large
Load Diff
@ -1,215 +0,0 @@
|
||||
/*************************************************************************/
|
||||
/* version_control_editor_plugin.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifndef VERSION_CONTROL_EDITOR_PLUGIN_H
|
||||
#define VERSION_CONTROL_EDITOR_PLUGIN_H
|
||||
|
||||
#include "editor/editor_plugin.h"
|
||||
#include "editor/editor_vcs_interface.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/tab_container.h"
|
||||
#include "scene/gui/text_edit.h"
|
||||
#include "scene/gui/tool_button.h"
|
||||
#include "scene/gui/tree.h"
|
||||
|
||||
class VersionControlEditorPlugin : public EditorPlugin {
|
||||
GDCLASS(VersionControlEditorPlugin, EditorPlugin)
|
||||
|
||||
public:
|
||||
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;
|
||||
|
||||
List<StringName> available_plugins;
|
||||
|
||||
PopupMenu *version_control_actions;
|
||||
|
||||
AcceptDialog *set_up_dialog;
|
||||
OptionButton *set_up_choice;
|
||||
Button *set_up_init_button;
|
||||
VBoxContainer *set_up_vbc;
|
||||
VBoxContainer *set_up_settings_vbc;
|
||||
LineEdit *set_up_username;
|
||||
LineEdit *set_up_password;
|
||||
LineEdit *set_up_ssh_public_key_path;
|
||||
LineEdit *set_up_ssh_private_key_path;
|
||||
LineEdit *set_up_ssh_passphrase;
|
||||
FileDialog *set_up_ssh_public_key_file_dialog;
|
||||
FileDialog *set_up_ssh_private_key_file_dialog;
|
||||
Label *set_up_warning_text;
|
||||
|
||||
OptionButton *commit_list_size_button;
|
||||
|
||||
AcceptDialog *branch_create_confirm;
|
||||
LineEdit *branch_create_name_input;
|
||||
Button *branch_create_ok;
|
||||
|
||||
AcceptDialog *remote_create_confirm;
|
||||
LineEdit *remote_create_name_input;
|
||||
LineEdit *remote_create_url_input;
|
||||
Button *remote_create_ok;
|
||||
|
||||
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;
|
||||
|
||||
TabContainer *dock_vbc;
|
||||
VBoxContainer *version_commit_dock;
|
||||
Tree *staged_files;
|
||||
Tree *unstaged_files;
|
||||
Tree *commit_list;
|
||||
|
||||
OptionButton *branch_select;
|
||||
Button *branch_remove_button;
|
||||
AcceptDialog *branch_remove_confirm;
|
||||
|
||||
ToolButton *fetch_button;
|
||||
ToolButton *pull_button;
|
||||
ToolButton *push_button;
|
||||
OptionButton *remote_select;
|
||||
Button *remote_remove_button;
|
||||
AcceptDialog *remote_remove_confirm;
|
||||
MenuButton *extra_options;
|
||||
PopupMenu *extra_options_remove_branch_list;
|
||||
PopupMenu *extra_options_remove_remote_list;
|
||||
|
||||
String branch_to_remove;
|
||||
String remote_to_remove;
|
||||
|
||||
ToolButton *stage_all_button;
|
||||
ToolButton *unstage_all_button;
|
||||
ToolButton *discard_all_button;
|
||||
ToolButton *refresh_button;
|
||||
TextEdit *commit_message;
|
||||
Button *commit_button;
|
||||
|
||||
VBoxContainer *version_control_dock;
|
||||
ToolButton *version_control_dock_button;
|
||||
Label *diff_title;
|
||||
RichTextLabel *diff;
|
||||
OptionButton *diff_view_type_select;
|
||||
bool show_commit_diff_header = false;
|
||||
List<EditorVCSInterface::DiffFile> diff_content;
|
||||
|
||||
void _notification(int p_what);
|
||||
void _initialize_vcs();
|
||||
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_path);
|
||||
void _set_up();
|
||||
|
||||
void _pull();
|
||||
void _push();
|
||||
void _force_push();
|
||||
void _fetch();
|
||||
void _commit();
|
||||
void _discard_all();
|
||||
void _refresh_stage_area();
|
||||
void _refresh_branch_list();
|
||||
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);
|
||||
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();
|
||||
|
||||
friend class EditorVCSInterface;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
static VersionControlEditorPlugin *get_singleton();
|
||||
|
||||
void popup_vcs_set_up_dialog(const Control *p_gui_base);
|
||||
void set_version_control_tool_button(ToolButton *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; }
|
||||
VBoxContainer *get_version_control_dock() const { return version_control_dock; }
|
||||
|
||||
List<StringName> get_available_vcs_names() const { return available_plugins; }
|
||||
|
||||
void register_editor();
|
||||
void fetch_available_vcs_plugin_names();
|
||||
void shut_down();
|
||||
|
||||
VersionControlEditorPlugin();
|
||||
~VersionControlEditorPlugin();
|
||||
};
|
||||
|
||||
#endif // !VERSION_CONTROL_EDITOR_PLUGIN_H
|
Loading…
Reference in New Issue
Block a user