Class Vcs

All Implemented Interfaces:
ContextProvider, PropertyChangeSource, Rebindable

public class Vcs extends AnahataToolkit
A toolkit for inspecting version-control status through IntelliJ's generic VCS layer.

A beyond-parity capability with no NetBeans equivalent. It uses the provider-agnostic ChangeListManager — which works for Git and any other configured VCS — to report changed, added, deleted and unversioned files, grouped by change list. VCS-provider-specific operations (Git branch/commit/log/blame) require the git4idea plugin API, which is not published as a resolvable artifact, so they are intentionally out of scope.

Author:
anahata
  • Constructor Details

    • Vcs

      public Vcs()
      Constructs the Vcs toolkit (instantiated reflectively via its public no-arg constructor).
  • Method Details

    • getVcsStatus

      public String getVcsStatus()
      Reports the version-control status of all open projects: local changes grouped by change list, plus unversioned files.
      Returns:
      a Markdown status report.
    • statusOf

      private static String statusOf(com.intellij.openapi.vcs.changes.Change change)
      Maps a change to a short status token.
      Parameters:
      change - the change.
      Returns:
      ADDED, DELETED, MOVED or MODIFIED.
    • pathOf

      private static String pathOf(com.intellij.openapi.vcs.changes.Change change)
      Resolves the best available path for a change (after-revision, else before-revision, else the virtual file).
      Parameters:
      change - the change.
      Returns:
      the file path, or "?" if none can be resolved.