Trait IEditorVcsInterface
pub trait IEditorVcsInterface: GodotClass<Base = EditorVcsInterface> + You_forgot_the_attribute__godot_api {
Show 31 methods
// Required methods
fn initialize(&mut self, project_path: GString) -> bool;
fn set_credentials(
&mut self,
username: GString,
password: GString,
ssh_public_key_path: GString,
ssh_private_key_path: GString,
ssh_passphrase: GString,
);
fn get_modified_files_data(&mut self) -> Array<AnyDictionary>;
fn stage_file(&mut self, file_path: GString);
fn unstage_file(&mut self, file_path: GString);
fn discard_file(&mut self, file_path: GString);
fn commit(&mut self, msg: GString);
fn get_diff(
&mut self,
identifier: GString,
area: i32,
) -> Array<AnyDictionary>;
fn shut_down(&mut self) -> bool;
fn get_vcs_name(&mut self) -> GString;
fn get_previous_commits(&mut self, max_commits: i32) -> Array<AnyDictionary>;
fn get_branch_list(&mut self) -> Array<GString>;
fn get_remotes(&mut self) -> Array<GString>;
fn create_branch(&mut self, branch_name: GString);
fn remove_branch(&mut self, branch_name: GString);
fn create_remote(&mut self, remote_name: GString, remote_url: GString);
fn remove_remote(&mut self, remote_name: GString);
fn get_current_branch_name(&mut self) -> GString;
fn checkout_branch(&mut self, branch_name: GString) -> bool;
fn pull(&mut self, remote: GString);
fn push(&mut self, remote: GString, force: bool);
fn fetch(&mut self, remote: GString);
fn get_line_diff(
&mut self,
file_path: GString,
text: GString,
) -> Array<AnyDictionary>;
// Provided methods
fn init(base: Base<Self::Base>) -> Self { ... }
fn on_notification(&mut self, what: ObjectNotification) { ... }
fn on_get(&self, property: StringName) -> Option<Variant> { ... }
fn on_set(&mut self, property: StringName, value: Variant) -> bool { ... }
fn on_validate_property(&self, property: &mut PropertyInfo) { ... }
fn on_get_property_list(&mut self) -> Vec<PropertyInfo> { ... }
fn on_property_get_revert(&self, property: StringName) -> Option<Variant> { ... }
fn to_string(&self) -> GString { ... }
}Expand description
§Interface trait for class EditorVcsInterface.
Functions in this trait represent constructors (init) or virtual method callbacks invoked by the engine.
§Related symbols
Base interfaces: IObject.
Required Methods§
fn initialize(&mut self, project_path: GString) -> bool
fn initialize(&mut self, project_path: GString) -> bool
Initializes the VCS plugin when called from the editor. Returns whether or not the plugin was successfully initialized. A VCS project is initialized at project_path.
fn set_credentials(
&mut self,
username: GString,
password: GString,
ssh_public_key_path: GString,
ssh_private_key_path: GString,
ssh_passphrase: GString,
)
fn set_credentials( &mut self, username: GString, password: GString, ssh_public_key_path: GString, ssh_private_key_path: GString, ssh_passphrase: GString, )
Set user credentials in the underlying VCS. username and password are used only during HTTPS authentication unless not already mentioned in the remote URL. ssh_public_key_path, ssh_private_key_path, and ssh_passphrase are only used during SSH authentication.
fn get_modified_files_data(&mut self) -> Array<AnyDictionary>
fn get_modified_files_data(&mut self) -> Array<AnyDictionary>
Returns an Array of Dictionary items (see create_status_file), each containing the status data of every modified file in the project folder.
fn stage_file(&mut self, file_path: GString)
fn stage_file(&mut self, file_path: GString)
Stages the file present at file_path to the staged area.
fn unstage_file(&mut self, file_path: GString)
fn unstage_file(&mut self, file_path: GString)
Unstages the file present at file_path from the staged area to the unstaged area.
fn discard_file(&mut self, file_path: GString)
fn discard_file(&mut self, file_path: GString)
Discards the changes made in a file present at file_path.
fn commit(&mut self, msg: GString)
fn commit(&mut self, msg: GString)
Commits the currently staged changes and applies the commit msg to the resulting commit.
fn get_diff(&mut self, identifier: GString, area: i32) -> Array<AnyDictionary>
fn get_diff(&mut self, identifier: GString, area: i32) -> Array<AnyDictionary>
Returns an array of Dictionary items (see create_diff_file, create_diff_hunk, create_diff_line, add_line_diffs_into_diff_hunk and add_diff_hunks_into_diff_file), each containing information about a diff. If identifier is a file path, returns a file diff, and if it is a commit identifier, then returns a commit diff.
fn shut_down(&mut self) -> bool
fn shut_down(&mut self) -> bool
Shuts down VCS plugin instance. Called when the user either closes the editor or shuts down the VCS plugin through the editor UI.
fn get_vcs_name(&mut self) -> GString
fn get_vcs_name(&mut self) -> GString
Returns the name of the underlying VCS provider.
fn get_previous_commits(&mut self, max_commits: i32) -> Array<AnyDictionary>
fn get_previous_commits(&mut self, max_commits: i32) -> Array<AnyDictionary>
Returns an Array of Dictionary items (see create_commit), each containing the data for a past commit.
fn get_branch_list(&mut self) -> Array<GString>
fn get_branch_list(&mut self) -> Array<GString>
fn get_remotes(&mut self) -> Array<GString>
fn get_remotes(&mut self) -> Array<GString>
fn create_branch(&mut self, branch_name: GString)
fn create_branch(&mut self, branch_name: GString)
Creates a new branch named branch_name in the VCS.
fn remove_branch(&mut self, branch_name: GString)
fn remove_branch(&mut self, branch_name: GString)
Remove a branch from the local VCS.
fn create_remote(&mut self, remote_name: GString, remote_url: GString)
fn create_remote(&mut self, remote_name: GString, remote_url: GString)
Creates a new remote destination with name remote_name and points it to remote_url. This can be an HTTPS remote or an SSH remote.
fn remove_remote(&mut self, remote_name: GString)
fn remove_remote(&mut self, remote_name: GString)
Remove a remote from the local VCS.
fn get_current_branch_name(&mut self) -> GString
fn get_current_branch_name(&mut self) -> GString
Gets the current branch name defined in the VCS.
fn checkout_branch(&mut self, branch_name: GString) -> bool
fn checkout_branch(&mut self, branch_name: GString) -> bool
Checks out a branch_name in the VCS.
fn pull(&mut self, remote: GString)
fn pull(&mut self, remote: GString)
Pulls changes from the remote. This can give rise to merge conflicts.
fn push(&mut self, remote: GString, force: bool)
fn push(&mut self, remote: GString, force: bool)
Pushes changes to the remote. If force is true, a force push will override the change history already present on the remote.
fn fetch(&mut self, remote: GString)
fn fetch(&mut self, remote: GString)
Fetches new changes from the remote, but doesn’t write changes to the current working directory. Equivalent to git fetch.
fn get_line_diff(
&mut self,
file_path: GString,
text: GString,
) -> Array<AnyDictionary>
fn get_line_diff( &mut self, file_path: GString, text: GString, ) -> Array<AnyDictionary>
Returns an Array of Dictionary items (see create_diff_hunk), each containing a line diff between a file at file_path and the text which is passed in.
Provided Methods§
fn init(base: Base<Self::Base>) -> Self
fn init(base: Base<Self::Base>) -> Self
Godot constructor, accepting an injected base object.
base refers to the base instance of the class, which can either be stored in a Base<T> field or discarded.
This method returns a fully-constructed instance, which will then be moved into a Gd<T> pointer.
If the class has a #[class(init)] attribute, this method will be auto-generated and must not be overridden.
fn on_notification(&mut self, what: ObjectNotification)
fn on_notification(&mut self, what: ObjectNotification)
Called when the object receives a Godot notification.
The type of notification can be identified through what. The enum is designed to hold all possible NOTIFICATION_*
constants that the current class can handle. However, this is not validated in Godot, so an enum variant Unknown exists
to represent integers out of known constants (mistakes or future additions).
This method is named _notification in Godot, but on_notification in Rust. To send notifications, use the
Object::notify method.
See also in Godot docs:
fn on_get(&self, property: StringName) -> Option<Variant>
fn on_get(&self, property: StringName) -> Option<Variant>
Called whenever get() is called or Godot gets the value of a property.
Should return the given property’s value as Some(value), or None if the property should be handled normally.
See also in Godot docs:
fn on_set(&mut self, property: StringName, value: Variant) -> bool
fn on_set(&mut self, property: StringName, value: Variant) -> bool
Called whenever Godot set() is called or Godot sets the value of a property.
Should set property to the given value and return true, or return false to indicate the property
should be handled normally.
See also in Godot docs:
fn on_validate_property(&self, property: &mut PropertyInfo)
fn on_validate_property(&self, property: &mut PropertyInfo)
Called whenever Godot retrieves value of property. Allows to customize existing properties.
Every property info goes through this method, except properties added with on_get_property_list().
Exposed property here is a shared mutable reference obtained (and returned to) from Godot.
See also in the Godot docs:
fn on_get_property_list(&mut self) -> Vec<PropertyInfo>
Available on since_api=4.3 only.
fn on_get_property_list(&mut self) -> Vec<PropertyInfo>
since_api=4.3 only.Called whenever Godot get_property_list() is called, the returned vector here is
appended to the existing list of properties.
This should mainly be used for advanced purposes, such as dynamically updating the property list in the editor.
See also in Godot docs:
fn on_property_get_revert(&self, property: StringName) -> Option<Variant>
fn on_property_get_revert(&self, property: StringName) -> Option<Variant>
Called by Godot to tell if a property has a custom revert or not.
Return None for no custom revert, and return Some(value) to specify the custom revert.
This is a combination of Godot’s Object::_property_get_revert and Object::_property_can_revert. This means that this
function will usually be called twice by Godot to find the revert.
Note that this should be a pure function. That is, it should always return the same value for a property as long as self
remains unchanged. Otherwise, this may lead to unexpected (safe) behavior.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.