[Previous: Writing a Simple Program with Qt Creator] [Qt Creator Manual] [Next: Navigating Quickly Around Your Code with Locator] Qt Creator and Version Control Systems
|
git | http://git-scm.com/ | |
Subversion | http://subversion.tigris.org/ | |
Perforce | http://www.perforce.com | Server version 2006.1 and later |
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. You can specify the path to the command line client's executable in the settings pages that can be found under Options... in the Tools menu.
You can find the version control menu entries in a sub-menu of the Tools menu. The version control system displayed here is the system that manages the current project.
Each version control system adds a pane to the Application Output panes within which it will log the commands it executes, prepended by a timestamp and the relevant output.
When you create a new file or a new project, the wizards will display page requesting whether the files should be added to a version control system. This depends on whether 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 also add files later on 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.
All version control systems provide menu options to diff the current file or project - comparing with the latest version stored in the repository and displaying 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 will open an editor displaying the file, scrolled to the line in question.
The versioning history of a file can be displayed by selecting the Log (for git) or Filelog (for Perforce and Subversion) option. Typically, the log output will contain the date, the commit message, and a change or revision identifier. If you click on the identifier, a description of the change including the diff will be displayed.
Annotation views are obtained by selecting Annotate or Blame. This will display 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.
Once you have finished making changes, you can submit them to the version control system by choosing Commit or Submit. Qt Creator will display 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 Commit to start committing. In addition, there is a Diff selected 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.
The git sub-menu contains additional entries:
Stash | Stash local changes prior to executing a pull. |
Pull | Pull changes from the remote repository. If there are locally modified files, you will be 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, simply double-click on it. Double-clicking on a remote branch will first create a local branch with the same name that tracks the remote branch, and then switch to it. |
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 <Jon.Doe@company.com> Hans Mustermann <Hans.Mustermann@company.com> hm <info@company.com>
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 will display a context menu with Insert name... that will pop 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 will 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.
[Previous: Writing a Simple Program with Qt Creator] [Qt Creator Manual] [Next: Navigating Quickly Around Your Code with Locator]
Copyright © 2009 Nokia | Qt Creator 1.2.1 |
Попытка перевода Qt документации. Если есть желание присоединиться, или если есть замечания или пожелания, то заходите на форум: Перевод Qt документации на русский язык... Люди внесшие вклад в перевод: Команда переводчиков |