.. _How to automatically checkout/lock files from the revision control system ?:

How to automatically checkout/lock files from the revision control system ?
===========================================================================

Let's suppose your project is tracked by a revision control system, for example Perforce, DesignSync or Clearcase, that keeps non checked out files read-only. In this scenario, you can instruct DVT to perform some actions on any read-only file that gets modified by direct editing or by refactoring:

#.  Create a new run configuration, named **DVT_CHECKOUT_HOOK**.
#.  In the newly created run configuration, add any script or command you wish to be performed on the read-only files that get modified. The list of files is in *${selected_resources_loc}* variable, by default separated by colon (:). **This doesn't work with ${selected_resource_loc}, only with the plural form ${selected_resources_loc}**. You can use custom separators. See the examples below, supposing the list of files is: file1.e, file2.sv, file3.vhdl.

    -  *${selected_resources_loc}* would expand to *file1.e:file2.sv:file3.vhdl*
    -  *${selected_resources_loc: }* would expand to *file1.e file2.sv file3.vhdl*
    -  *${selected_resources_loc: >> }* would expand to *file1.e >> file2.sv >> file3.vhdl*
#.  You can now use the **DVT_CHECKOUT_HOOK** run configuration in two ways:

    -  simply start to modify a read-only file and it will get triggered automatically
    -  select some files (in the Navigator) and manually launch the "DVT_CHECKOUT_HOOK" run configuration; note that you can map the run configuration to a toolbar button (see :ref:`Custom Shortcut and Button for a Run Configuration`)

Also, you can disable the checkout confirmation by inserting the following attribute in the DVT_CHECKOUT_HOOK run configuration file:

.. code-block::

    <booleanAttribute key="ro.amiq.dvt.launch.REQUIRE_CHECKOUT_CONFIRMATION" value="false"/>
