EditorVCSInterface

Inherits: Object Version Control System (VCS) interface which reads and writes to the local VCS in use.

Description

EditorVCSInterface. All the functions listed below, instead of performing the task themselves, they call the internally defined functions in the VCS addons to provide a plug-n-play experience.

Methods

Method Descriptions

  • commit ( String msg ) Creates a version commit if the addon is initialized, else returns without doing anything. Uses the files which have been staged previously, with the commit message set to a value as provided as in the argument.

  • Array get_file_diff ( String file_path ) Array of Dictionary objects containing the diff output from the VCS in use, if a VCS addon is initialized, else returns an empty Array object. The diff contents also consist of some contextual lines which provide context to the observed line change in the file. Dictionary object has the line diff contents under the keys:
  • "content" to store a String containing the line contents
  • "status" to store a String which contains "+" in case the content is a line addition but it stores a "-" in case of deletion and an empty string in the case the line content is neither an addition nor a deletion.
  • "new_line_number" to store an integer containing the new line number of the line content.
  • "line_count" to store an integer containing the number of lines in the line content.
  • "old_line_number" to store an integer containing the old line number of the line content.
  • "offset" to store the offset of the line change since the first contextual line content.

  • Dictionary get_modified_files_data ( ) Dictionary containing the path of the detected file change mapped to an integer signifying what kind of change the corresponding file has experienced. The following integer values are being used to signify that the detected file is:
  • 0: New to the VCS working directory
  • 1: Modified
  • 2: Renamed
  • 3: Deleted
  • 4: Typechanged

  • String get_project_name ( ) Returns the project name of the VCS working directory.

  • String get_vcs_name ( ) Returns the name of the VCS if the VCS has been initialized, else return an empty string.

  • bool initialize ( String project_root_path ) true if no failure occurs, else returns false.

  • bool is_addon_ready ( ) true if the addon is ready to respond to function calls, else returns false.

  • bool is_vcs_initialized ( ) true if the VCS addon has been initialized, else returns false.

  • bool shut_down ( ) true is no failure occurs, else returns false.

  • stage_file ( String file_path ) commit is called. Argument should contain the absolute path.

  • unstage_file ( String file_path ) commit is called. Argument should contain the absolute path.