Debian Codegraph @

doc/classes/EditorVCSInterface.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="EditorVCSInterface" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 Version Control System (VCS) interface, which reads and writes to the local VCS in use.
5 </brief_description>
6 <description>
7 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.
8 </description>
9 <tutorials>
10 <link title="Version control systems">$DOCS_URL/tutorials/best_practices/version_control_systems.html</link>
11 </tutorials>
12 <methods>
13 <method name="_checkout_branch" qualifiers="virtual required">
14 <return type="bool" />
15 <param index="0" name="branch_name" type="String" />
16 <description>
17 Checks out a [param branch_name] in the VCS.
18 </description>
19 </method>
20 <method name="_commit" qualifiers="virtual required">
21 <return type="void" />
22 <param index="0" name="msg" type="String" />
23 <description>
24 Commits the currently staged changes and applies the commit [param msg] to the resulting commit.
25 </description>
26 </method>
27 <method name="_create_branch" qualifiers="virtual required">
28 <return type="void" />
29 <param index="0" name="branch_name" type="String" />
30 <description>
31 Creates a new branch named [param branch_name] in the VCS.
32 </description>
33 </method>
34 <method name="_create_remote" qualifiers="virtual required">
35 <return type="void" />
36 <param index="0" name="remote_name" type="String" />
37 <param index="1" name="remote_url" type="String" />
38 <description>
39 Creates a new remote destination with name [param remote_name] and points it to [param remote_url]. This can be an HTTPS remote or an SSH remote.
40 </description>
41 </method>
42 <method name="_discard_file" qualifiers="virtual required">
43 <return type="void" />
44 <param index="0" name="file_path" type="String" />
45 <description>
46 Discards the changes made in a file present at [param file_path].
47 </description>
48 </method>
49 <method name="_fetch" qualifiers="virtual required">
50 <return type="void" />
51 <param index="0" name="remote" type="String" />
52 <description>
53 Fetches new changes from the [param remote], but doesn't write changes to the current working directory. Equivalent to [code]git fetch[/code].
54 </description>
55 </method>
56 <method name="_get_branch_list" qualifiers="virtual required">
57 <return type="String[]" />
58 <description>
59 Gets an instance of an [Array] of [String]s containing available branch names in the VCS.
60 </description>
61 </method>
62 <method name="_get_current_branch_name" qualifiers="virtual required">
63 <return type="String" />
64 <description>
65 Gets the current branch name defined in the VCS.
66 </description>
67 </method>
68 <method name="_get_diff" qualifiers="virtual required">
69 <return type="Dictionary[]" />
70 <param index="0" name="identifier" type="String" />
71 <param index="1" name="area" type="int" />
72 <description>
73 Returns an array of [Dictionary] items (see [method create_diff_file], [method create_diff_hunk], [method create_diff_line], [method add_line_diffs_into_diff_hunk] and [method add_diff_hunks_into_diff_file]), each containing information about a diff. If [param identifier] is a file path, returns a file diff, and if it is a commit identifier, then returns a commit diff.
74 </description>
75 </method>
76 <method name="_get_line_diff" qualifiers="virtual required">
77 <return type="Dictionary[]" />
78 <param index="0" name="file_path" type="String" />
79 <param index="1" name="text" type="String" />
80 <description>
81 Returns an [Array] of [Dictionary] items (see [method create_diff_hunk]), each containing a line diff between a file at [param file_path] and the [param text] which is passed in.
82 </description>
83 </method>
84 <method name="_get_modified_files_data" qualifiers="virtual required">
85 <return type="Dictionary[]" />
86 <description>
87 Returns an [Array] of [Dictionary] items (see [method create_status_file]), each containing the status data of every modified file in the project folder.
88 </description>
89 </method>
90 <method name="_get_previous_commits" qualifiers="virtual required">
91 <return type="Dictionary[]" />
92 <param index="0" name="max_commits" type="int" />
93 <description>
94 Returns an [Array] of [Dictionary] items (see [method create_commit]), each containing the data for a past commit.
95 </description>
96 </method>
97 <method name="_get_remotes" qualifiers="virtual required">
98 <return type="String[]" />
99 <description>
100 Returns an [Array] of [String]s, each containing the name of a remote configured in the VCS.
101 </description>
102 </method>
103 <method name="_get_vcs_name" qualifiers="virtual required">
104 <return type="String" />
105 <description>
106 Returns the name of the underlying VCS provider.
107 </description>
108 </method>
109 <method name="_initialize" qualifiers="virtual required">
110 <return type="bool" />
111 <param index="0" name="project_path" type="String" />
112 <description>
113 Initializes the VCS plugin when called from the editor. Returns whether or not the plugin was successfully initialized. A VCS project is initialized at [param project_path].
114 </description>
115 </method>
116 <method name="_pull" qualifiers="virtual required">
117 <return type="void" />
118 <param index="0" name="remote" type="String" />
119 <description>
120 Pulls changes from the remote. This can give rise to merge conflicts.
121 </description>
122 </method>
123 <method name="_push" qualifiers="virtual required">
124 <return type="void" />
125 <param index="0" name="remote" type="String" />
126 <param index="1" name="force" type="bool" />
127 <description>
128 Pushes changes to the [param remote]. If [param force] is [code]true[/code], a force push will override the change history already present on the remote.
129 </description>
130 </method>
131 <method name="_remove_branch" qualifiers="virtual required">
132 <return type="void" />
133 <param index="0" name="branch_name" type="String" />
134 <description>
135 Remove a branch from the local VCS.
136 </description>
137 </method>
138 <method name="_remove_remote" qualifiers="virtual required">
139 <return type="void" />
140 <param index="0" name="remote_name" type="String" />
141 <description>
142 Remove a remote from the local VCS.
143 </description>
144 </method>
145 <method name="_set_credentials" qualifiers="virtual required">
146 <return type="void" />
147 <param index="0" name="username" type="String" />
148 <param index="1" name="password" type="String" />
149 <param index="2" name="ssh_public_key_path" type="String" />
150 <param index="3" name="ssh_private_key_path" type="String" />
151 <param index="4" name="ssh_passphrase" type="String" />
152 <description>
153 Set user credentials in the underlying VCS. [param username] and [param password] are used only during HTTPS authentication unless not already mentioned in the remote URL. [param ssh_public_key_path], [param ssh_private_key_path], and [param ssh_passphrase] are only used during SSH authentication.
154 </description>
155 </method>
156 <method name="_shut_down" qualifiers="virtual required">
157 <return type="bool" />
158 <description>
159 Shuts down VCS plugin instance. Called when the user either closes the editor or shuts down the VCS plugin through the editor UI.
160 </description>
161 </method>
162 <method name="_stage_file" qualifiers="virtual required">
163 <return type="void" />
164 <param index="0" name="file_path" type="String" />
165 <description>
166 Stages the file present at [param file_path] to the staged area.
167 </description>
168 </method>
169 <method name="_unstage_file" qualifiers="virtual required">
170 <return type="void" />
171 <param index="0" name="file_path" type="String" />
172 <description>
173 Unstages the file present at [param file_path] from the staged area to the unstaged area.
174 </description>
175 </method>
176 <method name="add_diff_hunks_into_diff_file">
177 <return type="Dictionary" />
178 <param index="0" name="diff_file" type="Dictionary" />
179 <param index="1" name="diff_hunks" type="Dictionary[]" />
180 <description>
181 Helper function to add an array of [param diff_hunks] into a [param diff_file].
182 </description>
183 </method>
184 <method name="add_line_diffs_into_diff_hunk">
185 <return type="Dictionary" />
186 <param index="0" name="diff_hunk" type="Dictionary" />
187 <param index="1" name="line_diffs" type="Dictionary[]" />
188 <description>
189 Helper function to add an array of [param line_diffs] into a [param diff_hunk].
190 </description>
191 </method>
192 <method name="create_commit">
193 <return type="Dictionary" />
194 <param index="0" name="msg" type="String" />
195 <param index="1" name="author" type="String" />
196 <param index="2" name="id" type="String" />
197 <param index="3" name="unix_timestamp" type="int" />
198 <param index="4" name="offset_minutes" type="int" />
199 <description>
200 Helper function to create a commit [Dictionary] item. [param msg] is the commit message of the commit. [param author] is a single human-readable string containing all the author's details, e.g. the email and name configured in the VCS. [param id] is the identifier of the commit, in whichever format your VCS may provide an identifier to commits. [param unix_timestamp] is the UTC Unix timestamp of when the commit was created. [param offset_minutes] is the timezone offset in minutes, recorded from the system timezone where the commit was created.
201 </description>
202 </method>
203 <method name="create_diff_file">
204 <return type="Dictionary" />
205 <param index="0" name="new_file" type="String" />
206 <param index="1" name="old_file" type="String" />
207 <description>
208 Helper function to create a [Dictionary] for storing old and new diff file paths.
209 </description>
210 </method>
211 <method name="create_diff_hunk">
212 <return type="Dictionary" />
213 <param index="0" name="old_start" type="int" />
214 <param index="1" name="new_start" type="int" />
215 <param index="2" name="old_lines" type="int" />
216 <param index="3" name="new_lines" type="int" />
217 <description>
218 Helper function to create a [Dictionary] for storing diff hunk data. [param old_start] is the starting line number in old file. [param new_start] is the starting line number in new file. [param old_lines] is the number of lines in the old file. [param new_lines] is the number of lines in the new file.
219 </description>
220 </method>
221 <method name="create_diff_line">
222 <return type="Dictionary" />
223 <param index="0" name="new_line_no" type="int" />
224 <param index="1" name="old_line_no" type="int" />
225 <param index="2" name="content" type="String" />
226 <param index="3" name="status" type="String" />
227 <description>
228 Helper function to create a [Dictionary] for storing a line diff. [param new_line_no] is the line number in the new file (can be [code]-1[/code] if the line is deleted). [param old_line_no] is the line number in the old file (can be [code]-1[/code] if the line is added). [param content] is the diff text. [param status] is a single character string which stores the line origin.
229 </description>
230 </method>
231 <method name="create_status_file">
232 <return type="Dictionary" />
233 <param index="0" name="file_path" type="String" />
234 <param index="1" name="change_type" type="int" enum="EditorVCSInterface.ChangeType" />
235 <param index="2" name="area" type="int" enum="EditorVCSInterface.TreeArea" />
236 <description>
237 Helper function to create a [Dictionary] used by editor to read the status of a file.
238 </description>
239 </method>
240 <method name="popup_error">
241 <return type="void" />
242 <param index="0" name="msg" type="String" />
243 <description>
244 Pops up an error message in the editor which is shown as coming from the underlying VCS. Use this to show VCS specific error messages.
245 </description>
246 </method>
247 </methods>
248 <constants>
249 <constant name="CHANGE_TYPE_NEW" value="0" enum="ChangeType">
250 A new file has been added.
251 </constant>
252 <constant name="CHANGE_TYPE_MODIFIED" value="1" enum="ChangeType">
253 An earlier added file has been modified.
254 </constant>
255 <constant name="CHANGE_TYPE_RENAMED" value="2" enum="ChangeType">
256 An earlier added file has been renamed.
257 </constant>
258 <constant name="CHANGE_TYPE_DELETED" value="3" enum="ChangeType">
259 An earlier added file has been deleted.
260 </constant>
261 <constant name="CHANGE_TYPE_TYPECHANGE" value="4" enum="ChangeType">
262 An earlier added file has been typechanged.
263 </constant>
264 <constant name="CHANGE_TYPE_UNMERGED" value="5" enum="ChangeType">
265 A file is left unmerged.
266 </constant>
267 <constant name="TREE_AREA_COMMIT" value="0" enum="TreeArea">
268 A commit is encountered from the commit area.
269 </constant>
270 <constant name="TREE_AREA_STAGED" value="1" enum="TreeArea">
271 A file is encountered from the staged area.
272 </constant>
273 <constant name="TREE_AREA_UNSTAGED" value="2" enum="TreeArea">
274 A file is encountered from the unstaged area.
275 </constant>
276 </constants>
277 </class>