Retired Document
Important: This document, which describes Xcode 3, has been superseded in Xcode 4 by the chapter Repositories, Snapshots, and Archives from the Xcode Overview.
Snapshots
Snapshots allow you to save project state at particular points in time, which you can restore entirely or partially at a later point. Snapshots provide a multifile undo/redo mechanism that lets you experiment freely with your source files. A snapshot stores the state of a directory tree at the time it was taken. The changes you make can be easily reverted by restoring your project to a snapshot you made before the experiment.
At any particular time, a project can access only one snapshot store. A snapshot store is the set of snapshots taken from one or more projects with the same project root. (See General Project Attributes to learn how to set a project’s project root.)
Xcode stores snapshots in your home directory:
~/Library/Application Support/Developer/Shared/SnapshotRepository.sparseimage |
This chapter shows how to use locally stored snapshots to manage changes to multiple files.
The Snapshots Window
The Snapshots window (Figure 3-1) is where you view your project’s snapshots.
The Snapshots window contains the following items:
Snapshot list. Lists the snapshots accessible to the project, which is determined by the project root (see Managing Source in Xcode for details about the project root).
Name. The name of the snapshot. Xcode automatically names snapshots based on where you perform the Make Snapshot command.
Date. The date the snapshot was taken.
Archive. The filename of the snapshot.
Comments. Comments you add to the snapshot.
Changes pane. The differences between a file in the selected snapshot and the file in the project or another snapshot.
Making Snapshots
To make a snapshot, choose File > Make Snapshot.
You may want to change the snapshot name to reflect special circumstances.
To change the name of a snapshot, select the snapshot in the Snapshots list, and enter the new name in the Name field.
Comparing Snapshots
When you select a snapshot in the Snapshot window, the changed file list shows the differences between the snapshot and the current state of the project. That is, Xcode compares the snapshot against the project.
Sometimes you may need to know what changed between two snapshots. You can view the differences between two snapshots by selecting them in the Snapshot list.
Restoring Snapshots
To restore the project to the state represented by a particular snapshot, select the snapshot in the Snapshot list, and click Restore.
To restore a single file in a snapshot:
In the Snapshot list, select the desired snapshot.
In the file list, select the file to restore, and click Restore.
Click the Restore button.
To restore a single change instead of an entire file:
In the Snapshot list, select the desired snapshot.
In the file list, select the desired file.
In the changes pane, copy the text to restore.
Open the file into which you want to restore the copied text.
Paste the text in the appropriate location, and save the file.
Deleting Snapshots
From time to time, you may want to prune a snapshot store. You can do this by deleting individual snapshots or deleting the snapshot store.
To delete a snapshot, In the Snapshots window, select the snapshot you want to delete, and click Delete in the toolbar.
To delete a snapshot store, first Quit Xcode. Then in the Finder, navigate to the directory that contains the snapshot store (see Snapshots for details), and delete the SnapshotRepository.sparseimage
file.
Copyright © 2011 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2011-03-08