Monday, December 04, 2006

Using CVS with SQLDeveloper

This entry describes a very simple implementation of CVS as an external tool in Oracle's SQLDeveloper database ide. Integrated version control is promised for later releases, but until then an external tools implementation is the best that can be done.

The external tools interface is new in version 1.1 which is currently going through a preview cycle. There are limitations in the external tools interface which make it difficult to work with CVS in the way I would like to.

The external script

This is a windows batch file.
All it does is change directory to the source file directory and issue a commit.

@echo off
pushd %1
cvs commit -m%3 %2

The external tool definition

  1. Goto Tools > External Tools

    If this is the first time you have used the dialog, you will be prompted to set up some automatic definitions.
  2. Click on New and fill in the fields as follows

    • Program Executable:  <full path of batch file>
    • Arguments: ${file.dir} ${} "${promptl:label=Checkin comment} "

      The quotes round the final parameter are necessary because if can contain spaces. If your pathnames or file names contain spaces, the other parameters will need to be quoted too.
    • Run Directory: <directory containing batch file>

  3. Click Next

    As of build 2197 there are a couple of error dialogs to click through at this stage. They don't seem to affect the functionality.
  4. Fill in the display options as follows

    • Caption for Menu Items: C&VS commit

      This will set V as the accelerator for menu options.
    • ToolTip Text: Commit the current file to CVS
    • Icon Location: (Leave as default)

  5. Click Next
  6. Fill in the Integration options as appropriate. I haven't experimented with these, but you should have at least the tools menu selected. You should probably also check the Reload Open Files box.
  7. Fill in the display options as follows

    • Add items to Menus: 

      • Tools Menu - checked
      • Navigator Context menu - unchecked
      • Code Editor Context Menu - checked1

    • Add Buttons to Toolbars: 
        Main toolbar - Unchecked

    • After Tool Exits: 
      • Reload Open Files - Checked.

        This should ensure that if the file is modified during the commit (by keyword expansion for example), the new version is loaded into SQLDeveloper. NB. As of version, this causes the buffer to be closed

  8. Click Next
  9. File in the Availability options as follows.
    • Enabled: When specific file types are selected.
    • Selected types: 

      • SQL Script
      • Text Document
      • PlSqlNode1

  10. Click Finish

Note 1. These options will make the menu option available when editing PL/SQL in the database as well as in source files.


  • Only works on one file at a time
  • Only works on FILES, not other object nodes.
  • No access to the database. In the case of PL/SQL files I would like to be able to resubmit them to the database after checkin (so that the checkin comments and version numbers are up to date in the database. The external tools interface doesn't reliably provide connection details to allow this.


  • You can replace the commit command with other cvs commands, or you can make the cvs command a prompted parameter.
  • You can replace cvs with another version control tool.

No comments: