Previous: Implementing VCS actions, Up: Adding support for new Version Control Systems


16.9.4 Implementing VCS menus

GPS defines a standard set of Actions to interact with Version Control Systems. All these actions can be viewed, for instance, in the "VCS" of the Key Shortcuts dialog (see The Key Manager Dialog).

A Python facility exists in plugin vcs.py to associate menu items to VCS actions. This facility defines in one place the VCS menus that are to be displayed in the global VCS menu, in the contextual menus on contexts that contain files, and on the menus in the VCS explorer.

To use this facility, you must first define a list of associations in Python, and then register this list through a call to vcs.register_vcs_actions.

This function takes as parameter:

the name of the version control system
as defined in the name attribute of the vcs node in the XML definition.
a list of dictionaries
of the form ACTION : <name of the vcs action>, LABEL: <menu label>. The predefined SEPARATOR dictionary can be used to indicate a separator which will be displayed in the contextual menus on file and on the VCS Explorer.

If you have defined a custom VCS in a previous version of GPS, you will need to define your menus through this facility. The easiest is to simply copy one of the existing plugins (for instance subversion.py or clearcase.py) and simply change the first parameter in the call to register_vcs_actions.