Class EditorVcsInterface
- Namespace
- Godot
- Assembly
- GodotSharpEditor.dll
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.
[GodotClassName("EditorVCSInterface")]
public class EditorVcsInterface : GodotObject, IDisposable
- Inheritance
-
EditorVcsInterface
- Implements
- Inherited Members
Constructors
EditorVcsInterface()
public EditorVcsInterface()
Methods
AddDiffHunksIntoDiffFile(Dictionary, Array<Dictionary>)
Helper function to add an array of diffHunks into a diffFile.
public Dictionary AddDiffHunksIntoDiffFile(Dictionary diffFile, Array<Dictionary> diffHunks)
Parameters
diffFileDictionarydiffHunksArray<Dictionary>
Returns
AddLineDiffsIntoDiffHunk(Dictionary, Array<Dictionary>)
Helper function to add an array of lineDiffs into a diffHunk.
public Dictionary AddLineDiffsIntoDiffHunk(Dictionary diffHunk, Array<Dictionary> lineDiffs)
Parameters
diffHunkDictionarylineDiffsArray<Dictionary>
Returns
CreateCommit(string, string, string, long, long)
Helper function to create a commit Dictionary item. msg is the commit message of the commit. author is a single human-readable string containing all the author's details, e.g. the email and name configured in the VCS. id is the identifier of the commit, in whichever format your VCS may provide an identifier to commits. unixTimestamp is the UTC Unix timestamp of when the commit was created. offsetMinutes is the timezone offset in minutes, recorded from the system timezone where the commit was created.
public Dictionary CreateCommit(string msg, string author, string id, long unixTimestamp, long offsetMinutes)
Parameters
Returns
CreateDiffFile(string, string)
Helper function to create a Dictionary for storing old and new diff file paths.
public Dictionary CreateDiffFile(string newFile, string oldFile)
Parameters
Returns
CreateDiffHunk(int, int, int, int)
Helper function to create a Dictionary for storing diff hunk data. oldStart is the starting line number in old file. newStart is the starting line number in new file. oldLines is the number of lines in the old file. newLines is the number of lines in the new file.
public Dictionary CreateDiffHunk(int oldStart, int newStart, int oldLines, int newLines)
Parameters
Returns
CreateDiffLine(int, int, string, string)
Helper function to create a Dictionary for storing a line diff. newLineNo is the line number in the new file (can be -1 if the line is deleted). oldLineNo is the line number in the old file (can be -1 if the line is added). content is the diff text. status is a single character string which stores the line origin.
public Dictionary CreateDiffLine(int newLineNo, int oldLineNo, string content, string status)
Parameters
Returns
CreateStatusFile(string, ChangeType, TreeArea)
Helper function to create a Dictionary used by editor to read the status of a file.
public Dictionary CreateStatusFile(string filePath, EditorVcsInterface.ChangeType changeType, EditorVcsInterface.TreeArea area)
Parameters
filePathstringchangeTypeEditorVcsInterface.ChangeTypeareaEditorVcsInterface.TreeArea
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
methodgodot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signalgodot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
methodgodot_string_nameName of the method to invoke.
argsNativeVariantPtrArgsArguments to use with the invoked method.
retgodot_variantValue returned by the invoked method.
Returns
PopupError(string)
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.
public void PopupError(string msg)
Parameters
msgstring
_CheckoutBranch(string)
Checks out a branchName in the VCS.
public virtual bool _CheckoutBranch(string branchName)
Parameters
branchNamestring
Returns
_Commit(string)
Commits the currently staged changes and applies the commit msg to the resulting commit.
public virtual void _Commit(string msg)
Parameters
msgstring
_CreateBranch(string)
Creates a new branch named branchName in the VCS.
public virtual void _CreateBranch(string branchName)
Parameters
branchNamestring
_CreateRemote(string, string)
Creates a new remote destination with name remoteName and points it to remoteUrl. This can be an HTTPS remote or an SSH remote.
public virtual void _CreateRemote(string remoteName, string remoteUrl)
Parameters
_DiscardFile(string)
Discards the changes made in a file present at filePath.
public virtual void _DiscardFile(string filePath)
Parameters
filePathstring
_Fetch(string)
Fetches new changes from the remote, but doesn't write changes to the current working directory. Equivalent to git fetch.
public virtual void _Fetch(string remote)
Parameters
remotestring
_GetBranchList()
public virtual Array<string> _GetBranchList()
Returns
_GetCurrentBranchName()
Gets the current branch name defined in the VCS.
public virtual string _GetCurrentBranchName()
Returns
_GetDiff(string, int)
Returns an array of Dictionary items (see CreateDiffFile(string, string), CreateDiffHunk(int, int, int, int), CreateDiffLine(int, int, string, string), AddLineDiffsIntoDiffHunk(Dictionary, Array<Dictionary>) and AddDiffHunksIntoDiffFile(Dictionary, Array<Dictionary>)), 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.
public virtual Array<Dictionary> _GetDiff(string identifier, int area)
Parameters
Returns
_GetLineDiff(string, string)
Returns an Array of Dictionary items (see CreateDiffHunk(int, int, int, int)), each containing a line diff between a file at filePath and the text which is passed in.
public virtual Array<Dictionary> _GetLineDiff(string filePath, string text)
Parameters
Returns
_GetModifiedFilesData()
Returns an Array of Dictionary items (see CreateStatusFile(string, ChangeType, TreeArea)), each containing the status data of every modified file in the project folder.
public virtual Array<Dictionary> _GetModifiedFilesData()
Returns
_GetPreviousCommits(int)
Returns an Array of Dictionary items (see CreateCommit(string, string, string, long, long)), each containing the data for a past commit.
public virtual Array<Dictionary> _GetPreviousCommits(int maxCommits)
Parameters
maxCommitsint
Returns
_GetRemotes()
public virtual Array<string> _GetRemotes()
Returns
_GetVcsName()
Returns the name of the underlying VCS provider.
public virtual string _GetVcsName()
Returns
_Initialize(string)
Initializes the VCS plugin when called from the editor. Returns whether or not the plugin was successfully initialized. A VCS project is initialized at projectPath.
public virtual bool _Initialize(string projectPath)
Parameters
projectPathstring
Returns
_Pull(string)
Pulls changes from the remote. This can give rise to merge conflicts.
public virtual void _Pull(string remote)
Parameters
remotestring
_Push(string, bool)
Pushes changes to the remote. If force is true, a force push will override the change history already present on the remote.
public virtual void _Push(string remote, bool force)
Parameters
_RemoveBranch(string)
Remove a branch from the local VCS.
public virtual void _RemoveBranch(string branchName)
Parameters
branchNamestring
_RemoveRemote(string)
Remove a remote from the local VCS.
public virtual void _RemoveRemote(string remoteName)
Parameters
remoteNamestring
_SetCredentials(string, string, string, string, string)
Set user credentials in the underlying VCS. userName and password are used only during HTTPS authentication unless not already mentioned in the remote URL. sshPublicKeyPath, sshPrivateKeyPath, and sshPassphrase are only used during SSH authentication.
public virtual void _SetCredentials(string userName, string password, string sshPublicKeyPath, string sshPrivateKeyPath, string sshPassphrase)
Parameters
userNamestringpasswordstringsshPublicKeyPathstringsshPrivateKeyPathstringsshPassphrasestring
_ShutDown()
Shuts down VCS plugin instance. Called when the user either closes the editor or shuts down the VCS plugin through the editor UI.
public virtual bool _ShutDown()
Returns
_StageFile(string)
Stages the file present at filePath to the staged area.
public virtual void _StageFile(string filePath)
Parameters
filePathstring
_UnstageFile(string)
Unstages the file present at filePath from the staged area to the unstaged area.
public virtual void _UnstageFile(string filePath)
Parameters
filePathstring