EditorVCSInterface¶
继承: Object
版本控制系统(VCS)接口,用于读取和写入正在使用的本地VCS。
描述¶
定义编辑器用于从底层VCS中提取信息的API。此API的实现包含在VCS插件中,这些插件是继承EditorVCSInterface并附加(按需)到EditorVCSInterface的单例实例的S3Extension插件。下面列出的所有虚拟函数不是自己执行任务,而是调用VCS插件中的内部覆盖函数,以提供即插即用体验。自定义VCS插件应该继承自EditorVCSInterface并覆盖这些虚拟函数中的每一个。
方法¶
_checkout_branch(branch_name: String) virtual |
|
void |
|
void |
_create_branch(branch_name: String) virtual |
void |
_create_remote(remote_name: String, remote_url: String) virtual |
void |
_discard_file(file_path: String) virtual |
void |
|
_get_branch_list() virtual |
|
_get_current_branch_name() virtual |
|
_get_line_diff(file_path: String, text: String) virtual |
|
_get_modified_files_data() virtual |
|
_get_previous_commits(max_commits: int) virtual |
|
_get_remotes() virtual |
|
_get_vcs_name() virtual |
|
_initialize(project_path: String) virtual |
|
void |
|
void |
|
void |
_remove_branch(branch_name: String) virtual |
void |
_remove_remote(remote_name: String) virtual |
void |
_set_credentials(username: String, password: String, ssh_public_key_path: String, ssh_private_key_path: String, ssh_passphrase: String) virtual |
_shut_down() virtual |
|
void |
_stage_file(file_path: String) virtual |
void |
_unstage_file(file_path: String) virtual |
add_diff_hunks_into_diff_file(diff_file: Dictionary, diff_hunks: Array[Dictionary]) |
|
add_line_diffs_into_diff_hunk(diff_hunk: Dictionary, line_diffs: Array[Dictionary]) |
|
create_commit(msg: String, author: String, id: String, unix_timestamp: int, offset_minutes: int) |
|
create_diff_file(new_file: String, old_file: String) |
|
create_diff_hunk(old_start: int, new_start: int, old_lines: int, new_lines: int) |
|
create_diff_line(new_line_no: int, old_line_no: int, content: String, status: String) |
|
create_status_file(file_path: String, change_type: ChangeType, area: TreeArea) |
|
void |
popup_error(msg: String) |
枚举¶
enum ChangeType: 🔗
ChangeType CHANGE_TYPE_NEW = 0
添加了一个新文件。
ChangeType CHANGE_TYPE_MODIFIED = 1
较早添加的文件已被修改。
ChangeType CHANGE_TYPE_RENAMED = 2
较早添加的文件已重命名。
ChangeType CHANGE_TYPE_DELETED = 3
较早添加的文件已被删除。
ChangeType CHANGE_TYPE_TYPECHANGE = 4
较早添加的文件已被键入更改。
ChangeType CHANGE_TYPE_UNMERGED = 5
文件未合并。
enum TreeArea: 🔗
TreeArea TREE_AREA_COMMIT = 0
从提交区域遇到提交。
TreeArea TREE_AREA_STAGED = 1
从暂存区域遇到文件。
TreeArea TREE_AREA_UNSTAGED = 2
从未暂存区域遇到文件。
方法说明¶
bool _checkout_branch(branch_name: String) virtual 🔗
检查VCS中的branch_name。
void _commit(msg: String) virtual 🔗
提交当前暂存的更改并将提交msg应用于结果提交。
void _create_branch(branch_name: String) virtual 🔗
在VCS中创建一个名为branch_name的新分支。
void _create_remote(remote_name: String, remote_url: String) virtual 🔗
创建一个名为remote_name的新远程目标并将其指向remote_url。这可以是HTTPS远程或SSH远程。
void _discard_file(file_path: String) virtual 🔗
丢弃file_path中存在的文件中所做的更改。
void _fetch(remote: String) virtual 🔗
从remote获取新更改,但不将更改写入当前工作目录。相当于git fetch。
Array[String] _get_branch_list() virtual 🔗
获取包含VCS中可用分支名称的String的Array的实例。
String _get_current_branch_name() virtual 🔗
获取VCS中定义的当前分支名称。
Array[Dictionary] _get_diff(identifier: String, area: int) virtual 🔗
返回Dictionary项的数组(参见create_diff_file()、create_diff_hunk()、create_diff_line()、add_line_diffs_into_diff_hunk()和add_diff_hunks_into_diff_file()),每个项都包含有关diff的信息。如果identifier是文件路径,则返回文件diff,如果是提交标识符,则返回提交diff。
Array[Dictionary] _get_line_diff(file_path: String, text: String) virtual 🔗
返回Dictionary项的Array(参见create_diff_hunk()),每个项包含file_path处的文件和传入的text之间的行差异。
Array[Dictionary] _get_modified_files_data() virtual 🔗
返回Dictionary项的Array(参见create_status_file()),每个项包含项目文件夹中每个修改文件的状态数据。
Array[Dictionary] _get_previous_commits(max_commits: int) virtual 🔗
返回Dictionary项的Array(参见create_commit()),每个项都包含过去提交的数据。
Array[String] _get_remotes() virtual 🔗
返回Strings的Array,每个都包含在VCS中配置的远程的名称。
String _get_vcs_name() virtual 🔗
返回基础VCS提供程序的名称。
bool _initialize(project_path: String) virtual 🔗
从编辑器调用时初始化VCS插件。返回插件是否已成功初始化。VCS项目在project_path处初始化。
void _pull(remote: String) virtual 🔗
从远程拉取更改。这可能会导致合并冲突。
void _push(remote: String, force: bool) virtual 🔗
将更改推送到remote。如果force为true,则强制推送将覆盖远程上已存在的更改历史记录。
void _remove_branch(branch_name: String) virtual 🔗
从本地VCS中删除分支。
void _remove_remote(remote_name: String) virtual 🔗
从本地VCS中删除遥控器。
void _set_credentials(username: String, password: String, ssh_public_key_path: String, ssh_private_key_path: String, ssh_passphrase: String) virtual 🔗
username和password仅在HTTPS身份验证期间使用,除非远程URL中尚未提及。ssh_public_key_path、ssh_private_key_path和ssh_passphrase仅在SSH身份验证期间使用。
关闭VCS插件实例。当用户关闭编辑器或通过编辑器UI关闭VCS插件时调用。
void _stage_file(file_path: String) virtual 🔗
将file_path处的文件暂存到暂存区域。
void _unstage_file(file_path: String) virtual 🔗
将file_path处的文件从暂存区域取消暂存到未暂存区域。
Dictionary add_diff_hunks_into_diff_file(diff_file: Dictionary, diff_hunks: Array[Dictionary]) 🔗
Helper函数将diff_hunks数组添加到diff_file中。
Dictionary add_line_diffs_into_diff_hunk(diff_hunk: Dictionary, line_diffs: Array[Dictionary]) 🔗
Helper函数将line_diffs数组添加到diff_hunk中。
Dictionary create_commit(msg: String, author: String, id: String, unix_timestamp: int, offset_minutes: int) 🔗
用于创建提交Dictionary项的辅助函数。msg是提交的提交消息。author是一个人类可读的字符串,包含作者的所有详细信息,例如在VCS中配置的电子邮件和姓名。id是提交的标识符,无论您的VCS以哪种格式提供提交标识符。unix_timestamp是创建提交时的UTC Unix时间戳。offset_minutes是时区偏移(以分钟为单位),记录自创建提交的系统时区。
Dictionary create_diff_file(new_file: String, old_file: String) 🔗
帮助函数创建用于存储新旧差异文件路径的Dictionary。
Dictionary create_diff_hunk(old_start: int, new_start: int, old_lines: int, new_lines: int) 🔗
帮助函数创建用于存储diff hunk数据的Dictionary。old_start是旧文件中的起始行号。new_start是新文件中的起始行号。old_lines是旧文件中的行数。new_lines是新文件中的行数。
Dictionary create_diff_line(new_line_no: int, old_line_no: int, content: String, status: String) 🔗
用于创建用于存储行差异的Dictionary的辅助函数。new_line_no是新文件中的行号(如果行被删除,可以是-1)。old_line_no是旧文件中的行号(如果添加了行,可以是-1)。content是差异文本。status是存储行原点的单个字符串。
Dictionary create_status_file(file_path: String, change_type: ChangeType, area: TreeArea) 🔗
帮助函数,用于创建编辑器用来读取文件状态的Dictionary。
void popup_error(msg: String) 🔗
在编辑器中弹出一条错误消息,显示为来自底层VCS。使用它来显示VCS特定的错误消息。