Using the History Manager
Go Up to How To Edit Code in the Code Editor
The History Manager lets you view and compare versions of a file, including multiple backup versions, saved local changes, and the edit buffer of unsaved changes.
Note: For information about using a version control system in the History Manager, see:
- For Subversion: Subversion Integration in the IDE.
- For Git: Git Integration in the IDE.
- For Mercurial: Mercurial Integration in the IDE.
For simplicity, this topic is written as a tutorial that uses a small text file to introduce the functionality of the History Manager. However, the History Manager is available for most files, including source code and HTML or XML files.
Tutorial Step 1: To create and display file versions in the Contents page
- Choose Tools > Options > Editor Options page and verify that the Create Backup Files option is checked.
- Choose File > New > Other > Other Files > Text File and click OK to display a blank text file in the Code Editor.
- On line one of the file, type First line of text and save the file using any name and location.
- On line two, type Second line of text and save the file.
- On line three, type Third line of text and save the file. There are now three versions of the file stored in the current directory in a hidden directory named __history.
- Click the History tab, which is next to the Code tab. The revision list at the top of the Contents tab displays three versions of the file. The first version is named ~1~, the second is named ~2~, and the current version is named File. The source viewer at the bottom of the tab displays the source for the selected version.
- Select the different versions to display their source in the source viewer.
- Click the Code tab to return to the Code Editor and on line four of the file, type Fourth line of text but do not save the file. Your change is stored in the editor buffer, but not saved to the file.
- Review the following toolbar and icon descriptions and then use the next procedure to compare the file versions that you just created.
Tip: To sort a column on any page of the History Manager, click the column heading.
Tutorial Step 2: To compare file versions using the Diff page
- Using the file that you created in the previous procedure, click the History tab.
- Click the Differences tab at the bottom of the History Manager.The Differences From and To panes at the top of the page shows the file versions that you can compare. At the bottom of the page, source lines that were deleted are highlighted and marked with a minus sign (-). Lines that were added are highlighted and marked with a plus sign (+). The highlighting colors depend on the Code Editor colors.
- Select the different file versions in both the Differences From pane and the To pane to see the results in source viewer.
Tutorial Step 3: To make a prior file version the current version
- Using the file from the previous procedures, click the Contents tab.
- Right-click the ~2~ version of the file and select Revert, or click the toolbar button.The Confirm dialog box indicates that reverting the file will lose any unsaved changes in the buffer.
- Click Yes on Confirm dialog box. The ~2~ version becomes the current version.
- Return to the Code Editor and save the change.
Tip: The Revert command is also available on the Info page.