<type>documentation</type>
<domain>intro</domain>
<id>tutorial-vcs</id>
<title>Tutorial: Version Control Systems</title>
<date>$Date: 2013-06-27 19:22:37 -0400 (Thu, 27 Jun 2013) $</date>
<product>pro+</product>

Wing Pro includes revision control integrations for ``Git``, ``Mercurial``,
``Subversion``, ``Perforce``, ``Bazaar``, and ``CVS``. These auto-enable based on the
contents of your project and provide the most commonly used operations such as
commit, status, log, diff, pull, revert, and update.  The set of operations
supported varies for each version control system.

If you have a code base that is in revision control you might want to try this out now, by
adding your code to the tutorial project with ``Add Existing Directory`` in the
``Project`` menu.

Once that is done, Wing should auto-detect the revision control system and add a menu to
the menu bar. You can now select ``Project Status`` from that menu or use the ``Tools``
menu to bring up the appropriate revision control tool. Use the menu or right-click on the
tool to initiate operations.

If you have a project with files in multiple revision control systems, or if you want to
keep a particular system active at all times, you can do this from the `Version Control
<script:show_preferences_gui#prefname="versioncontrol.enable-non-script">`__ preference
group.

See `Version Control <ref:versioncontrol/index>`__ for details.

**Difference and Merge**

When a revision control system is active, you can compare the working copy of your code to
the repository revision it is based on by right-clicking on items in the revision control
tool or on the editor or ``Project`` tool.

This tool can also be used to compare two files, two directories, and an unsaved file with
the disk.

Try it now by making several changes to ``example1.py`` without saving them to disk. Then
click on the |diff-merge| ``Difference/Merge`` icon in the toolbar to select ``Compare
Buffer With Disk``.

.. |diff-merge| image:: diff-merge.png
  :class: inline-image

Wing splits the editor area to show two editors side by side and shows additional icons in
the toolbar to control the difference and merge session:

.. image:: diff-merge-session.png
  :width: 734
  :height: 498
  
Use the ``Previous Difference`` and ``Next Difference`` items to move through the
differences and the ``Merge A->B`` tool to undo unsaved changes.

When comparing directories, Wing shows the ``Diff/Merge`` tool while the session is
active, and highlights the current file being compared as you move through the session.
You can also click on files in this tool to move to a specific comparison.

``Difference/Merge`` is particularly useful for reviewing and undoing any unwanted changes
before committing to a revision control repository.

See `Difference and Merge <ref:diff/index>`__ for details.
