EditorVCSInterface
Version Control System (VCS) interface, which reads and writes to the local VCS in use.
EditorVCSInterface.swift:17class EditorVCSInterface
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.
Superclasses
class Object
Base class for all other classes in the engine.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
Instance members
func addDiffHunksIntoDiffFile(GDictionary, diffHunks: VariantCollection<GDictionary>
) -> GDictionary Helper function to add an array of
diffHunks
into adiffFile
.func addLineDiffsIntoDiffHunk(GDictionary, lineDiffs: VariantCollection<GDictionary>
) -> GDictionary Helper function to add an array of
lineDiffs
into adiffHunk
.func createDiffFile(newFile: String, oldFile: String
) -> GDictionary Helper function to create a
GDictionary
for storing old and new diff file paths.func createDiffHunk(oldStart: Int32, newStart: Int32, oldLines: Int32, newLines: Int32
) -> GDictionary Helper function to create a
GDictionary
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.func createDiffLine(newLineNo: Int32, oldLineNo: Int32, content: String, status: String
) -> GDictionary Helper function to create a
GDictionary
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.func createStatusFile(filePath: String, changeType: EditorVCSInterface.ChangeType, area: EditorVCSInterface.TreeArea
) -> GDictionary Helper function to create a
GDictionary
used by editor to read the status of a file.func popupError(msg: 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.
Show implementation details (23)
Hide implementation details
func _checkoutBranch(branchName: String
) -> Bool Checks out a
branchName
in the VCS.func _commit(msg: String
) Commits the currently staged changes and applies the commit
msg
to the resulting commit.func _createBranch(branchName: String
) Creates a new branch named
branchName
in the VCS.func _createRemote(remoteName: String, remoteUrl: String
) Creates a new remote destination with name
remoteName
and points it toremoteUrl
. This can be an HTTPS remote or an SSH remote.func _discardFile(filePath: String
) Discards the changes made in a file present at
filePath
.func _fetch(remote: String
) Fetches new changes from the
remote
, but doesn’t write changes to the current working directory. Equivalent togit fetch
.func _getBranchList(
) -> VariantCollection<String> Gets an instance of an
GArray
ofString
s containing available branch names in the VCS.func _getCurrentBranchName(
) -> String Gets the current branch name defined in the VCS.
func _getDiff(identifier: String, area: Int32
) -> VariantCollection<GDictionary> Returns an array of
GDictionary
items (seecreateDiffFile(newFile:oldFile:)
,createDiffHunk(oldStart:newStart:oldLines:newLines:)
,createDiffLine(newLineNo:oldLineNo:content:status:)
,addLineDiffsIntoDiffHunk(_:lineDiffs:)
andaddDiffHunksIntoDiffFile(_:diffHunks:)
), each containing information about a diff. Ifidentifier
is a file path, returns a file diff, and if it is a commit identifier, then returns a commit diff.func _getLineDiff(filePath: String, text: String
) -> VariantCollection<GDictionary> Returns an
GArray
ofGDictionary
items (seecreateDiffHunk(oldStart:newStart:oldLines:newLines:)
), each containing a line diff between a file atfilePath
and thetext
which is passed in.func _getModifiedFilesData(
) -> VariantCollection<GDictionary> Returns an
GArray
ofGDictionary
items (seecreateStatusFile(filePath:changeType:area:)
), each containing the status data of every modified file in the project folder.func _getPreviousCommits(maxCommits: Int32
) -> VariantCollection<GDictionary> Returns an
GArray
ofGDictionary
items (seecreateCommit(msg:author:id:unixTimestamp:offsetMinutes:)
), each containing the data for a past commit.func _getRemotes(
) -> VariantCollection<String> Returns an
GArray
ofString
s, each containing the name of a remote configured in the VCS.func _getVcsName(
) -> String Returns the name of the underlying VCS provider.
func _initialize(projectPath: String
) -> 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
projectPath
.func _pull(remote: String
) Pulls changes from the remote. This can give rise to merge conflicts.
func _push(remote: String, force: Bool
) Pushes changes to the
remote
. Ifforce
istrue
, a force push will override the change history already present on the remote.func _removeBranch(branchName: String
) Remove a branch from the local VCS.
func _removeRemote(remoteName: String
) Remove a remote from the local VCS.
func _setCredentials(username: String, password: String, sshPublicKeyPath: String, sshPrivateKeyPath: String, sshPassphrase: String
) Set user credentials in the underlying VCS.
username
andpassword
are used only during HTTPS authentication unless not already mentioned in the remote URL.sshPublicKeyPath
,sshPrivateKeyPath
, andsshPassphrase
are only used during SSH authentication.func _shutDown(
) -> Bool Shuts down VCS plugin instance. Called when the user either closes the editor or shuts down the VCS plugin through the editor UI.
func _stageFile(filePath: String
) Stages the file present at
filePath
to the staged area.func _unstageFile(filePath: String
) Unstages the file present at
filePath
from the staged area to the unstaged area.