Table of Contents

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

diffFile Dictionary
diffHunks Array<Dictionary>

Returns

Dictionary

AddLineDiffsIntoDiffHunk(Dictionary, Array<Dictionary>)

Helper function to add an array of lineDiffs into a diffHunk.

public Dictionary AddLineDiffsIntoDiffHunk(Dictionary diffHunk, Array<Dictionary> lineDiffs)

Parameters

diffHunk Dictionary
lineDiffs Array<Dictionary>

Returns

Dictionary

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

msg string
author string
id string
unixTimestamp long
offsetMinutes long

Returns

Dictionary

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

newFile string
oldFile string

Returns

Dictionary

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

oldStart int
newStart int
oldLines int
newLines int

Returns

Dictionary

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

newLineNo int
oldLineNo int
content string
status string

Returns

Dictionary

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

filePath string
changeType EditorVcsInterface.ChangeType
area EditorVcsInterface.TreeArea

Returns

Dictionary

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

method godot_string_name

Name of the method to check for.

Returns

bool

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

signal godot_string_name

Name of the signal to check for.

Returns

bool

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

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

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

msg string

_CheckoutBranch(string)

Checks out a branchName in the VCS.

public virtual bool _CheckoutBranch(string branchName)

Parameters

branchName string

Returns

bool

_Commit(string)

Commits the currently staged changes and applies the commit msg to the resulting commit.

public virtual void _Commit(string msg)

Parameters

msg string

_CreateBranch(string)

Creates a new branch named branchName in the VCS.

public virtual void _CreateBranch(string branchName)

Parameters

branchName string

_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

remoteName string
remoteUrl string

_DiscardFile(string)

Discards the changes made in a file present at filePath.

public virtual void _DiscardFile(string filePath)

Parameters

filePath string

_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

remote string

_GetBranchList()

Gets an instance of an Array of strings containing available branch names in the VCS.

public virtual Array<string> _GetBranchList()

Returns

Array<string>

_GetCurrentBranchName()

Gets the current branch name defined in the VCS.

public virtual string _GetCurrentBranchName()

Returns

string

_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

identifier string
area int

Returns

Array<Dictionary>

_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

filePath string
text string

Returns

Array<Dictionary>

_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

Array<Dictionary>

_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

maxCommits int

Returns

Array<Dictionary>

_GetRemotes()

Returns an Array of strings, each containing the name of a remote configured in the VCS.

public virtual Array<string> _GetRemotes()

Returns

Array<string>

_GetVcsName()

Returns the name of the underlying VCS provider.

public virtual string _GetVcsName()

Returns

string

_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

projectPath string

Returns

bool

_Pull(string)

Pulls changes from the remote. This can give rise to merge conflicts.

public virtual void _Pull(string remote)

Parameters

remote string

_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

remote string
force bool

_RemoveBranch(string)

Remove a branch from the local VCS.

public virtual void _RemoveBranch(string branchName)

Parameters

branchName string

_RemoveRemote(string)

Remove a remote from the local VCS.

public virtual void _RemoveRemote(string remoteName)

Parameters

remoteName string

_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

userName string
password string
sshPublicKeyPath string
sshPrivateKeyPath string
sshPassphrase string

_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

bool

_StageFile(string)

Stages the file present at filePath to the staged area.

public virtual void _StageFile(string filePath)

Parameters

filePath string

_UnstageFile(string)

Unstages the file present at filePath from the staged area to the unstaged area.

public virtual void _UnstageFile(string filePath)

Parameters

filePath string