Developing VCS Integration Plugins for IntelliJ IDEA

compared with
Current by Dmitry Jemerov
on Jan 17, 2008 20:38.

This line was removed.
This word was removed. This word was added.
This line was added.

Changes (2)

View Page History
* Committed (CommittedChangeList) represents a set of modifications checked in to the VCS repository. For VCSes which support atomic commit, every committed revision is represented by a CommittedChangeList. For VCSes which use per-file commit (like CVS), the plugin can use heuristics to group a sequence of individual file commits into a CommittedChangeList.

Note: The "Unversioned Files", "Locally Deleted Files" etc. nodes in the Changes view are not actually changelists, and files under those nodes are not represented by Change objects.

h2. Plugin Components

Here 'name' is the unique name of the VCS (this must match the string returned by your implementation of AbstractVcs.getName()), and 'vcsClass' is your implementation class.

h3. ChangeProvider

This component is responsible for keeping track of the local changes done by the user in his working copy, and reporting these changes to the IntelliJ IDEA core. An implementation of this class is returned from AbstractVcs.getChangeProvider().

The ChangeProvider works in tandem with VcsDirtyScopeManager, which is a component in IntelliJ IDEA core. VcsDirtyScopeManager keeps track of the 'dirty scope' - the set of files for which the VCS file status may be out of date. Files are added to the dirty scope either when they are modified on disk, or when their VCS status is invalidated by an explicit call to VcsDirtyScopeManager.fileDirty() or VcsDirtyScopeManager.dirDirtyRecursively().

After some files have been added to the dirty scope, the dirty scope is passed to ChangeProvider.getChanges(), along with a ChangelistBuilder instance, which serves as a sink to which the ChangeProvider feeds the data about the changed files. This processing happens asynchronously in a background thread.

The ChangeProvider can either iterate all files under the dirty scope using VcsDirtyScope.iterate(), or retrieve information about its contents using the getDirtyFiles() and getDirtyDirectoriesRecursively() methods. If it is possible to retrieve the information about the local changes from the VCS in batch, it's strongly preferable to use the second method, as it scales much better for large working copies.

The ChangeProvider reports data to ChangelistBuilder using the following methods:
* processChange() is called for files which have been checked out (or modified if the VCS doesn't use an explicit checkout model), scheduled for addition or deletion, moved or renamed.
* processUnversionedFile() is called for files which exist on disk, but are not managed by the VCS, not scheduled for addition, and not ignored through .cvsignore or a similar mechanism.
* processLocallyDeletedFile() is called for files which exist in the VCS repository, but do not exist on disk and are not scheduled for deletion.
* processModifiedWithoutCheckout() is used only with VCSes which use an explicit checkout model. It is called for files which are writable on disk but not checked out through the VCS.
* processIgnoredFile() is called for files which are not managed by the VCS but are ignored through .cvsignore or a similar mechanism.
* processSwitchedFile() is called for files or directories for which the working copy corresponds to a different branch compared to the working copy of their parent directory. This can be called for the same files for which processSwitchedFile() has already been called.