Home · Editor · Code Navigation · Shortcuts · Wiki

[Previous: Qt Creator and Debugging] [Qt Creator Manual] [Next: Tips and Tricks]

Qt Creator and Version Control Systems

Version control systems supported by Qt Creator

githttp://git-scm.com/
Subversionhttp://subversion.tigris.org/
Perforcehttp://www.perforce.comServer version 2006.1 and later
CVShttp://www.cvshome.org

Setting Up Version Control Systems

Qt Creator uses the version control system's command line clients to access your repositories. To set it up, you must ensure that these command line clients can be located via the PATH environment variable. To specify the path to the command line client's executable, go to the settings pages in Tools > Options....

Setting Up Common Options

The Version Control > Common settings page features common settings for version control systems, such as commit message line wrapping and checking options.

Submit message checking script is a script or program that can be used to perform checks on the submit message before submitting. The submit message is passed in as the script's first parameter. If there is an error, the script should output a message on standard error and return a non-zero exit code.

User/alias configuration file takes a file in mailmap format that lists user names and aliases. For example:

    Jon Doe <[email protected]>
    Hans Mustermann <[email protected]> hm <[email protected]>

Notice that the second line specifies the alias hm and the corresponding email address for Hans Mustermann. If the user/alias configuration file is present, the submit editor displays a context menu with Insert name... that pops up a dialog letting the user select a name.

User field configuration file is a simple text file consisting of lines specifying submit message fields that take user names, for example:

    Reviewed-by:
    Signed-off-by:

These fields appear below the submit message. They provide completion for the aliases/public user names specified in the User/alias configuration file as well as a button that opens the aforementioned user name dialog.

Using Version Control Systems

The version control sub-menus are in Tools menu. The version control system managing the current project is displayed here.

Each version control system adds a pane to the Application Output panes within which itlogs the commands it executes, prepended by a timestamp and the relevant output.

Addings Files

When you create a new file or a new project, the wizard displays a page asking whether the files should be added to a version control system. This happens when the parent directory or the project is already under version control and the system supports the concept of adding files, e.g., Perforce and Subversion. Alternatively, you can add files later by using the version control tool menus.

With git, there is no concept of adding files. Instead, all modified files must be staged for a commit.

Viewing Diff Output

All version control systems provide menu options to diff the current file or project: to compare it with the latest version stored in the repository and to display the differences. In Qt Creator, a diff is displayed in a read-only editor. If the file is accessible, you can double-click on a selected diff chunk and Qt Creator opens an editor displaying the file, scrolled to the line in question.

Annotating Files

Annotation views are obtained by selecting Annotate or Blame. This displays the lines of the file prepended by the change identifier they originate from. Clicking on the change identifier shows a detailed description of the file.

Committing Changes

Once you have finished making changes, you can submit them to the version control system by choosing Commit or Submit. Qt Creator displays a commit page containing a text editor, where you can enter your commit message, and a checkable list of modified files to be included. When you are done, click on Commit to start committing. In addition, there is a Diff Selected Files button that brings up a diff view of the files selected in the file list. Since the commit page is just another editor, you can go back to it by closing the diff view. Alternatively, you can view it from the editor combo box showing the Opened files.

Viewing Versioning History and Change Details

The versioning history of a file is displayed by selecting Log (for git) or Filelog (for Perforce and Subversion). Typically, the log output contains the date, the commit message, and a change or revision identifier. Click on the identifier to display a description of the change including the diff.

Using git-specific Menu Entries

The git sub-menu contains additional entries:

StashStash local changes prior to executing a pull.
PullPull changes from the remote repository. If there are locally modified files, you are prompted to stash those changes.
Branches...Displays the branch dialog showing the local branches at the top and remote branches at the bottom. To switch to the local branch, double-click on it. Double-clicking on a remote branch first creates a local branch with the same name that tracks the remote branch, and then switches to it.

[Previous: Qt Creator and Debugging] [Qt Creator Manual] [Next: Tips and Tricks]


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Creator 1.3.0