COUndoTrack class documentation
COUndoTrack : NSObject <COTrack>Overview
For a commit done in an editing context, an undo track can be passed using -[COEditingContext commitWithIdentifier:metadata:undoTrack:error:] or similar commit methods. When the commit is saved, the editing context records the commit as a command using -recordCommand: . At this point, the undo track saves the command on disk.
Commits that contain object graph context changes result in new revisions in the store. For other commits that just contain store structure changes:
- branch creation
- branch deletion
- branch undeletion
- branch switch
- branch revision change
- branch metadata editing (e.g. branch renaming)
- persistent root creation
- persistent root deletion
- persistent root undeletion
no new revisions is created. The store doesn't record them in any way.
However an undo track can track both:- store structure history (represented as custom commands e.g. COCommandDeleteBranch etc.)
- branch history (new revisions represented as COCommandSetVersionForBranch)
Undo tracks can track all these changes or a subset per application or per use cases, and provide undo/redo support. For undo/redo menu actions, never manipulate the branch history directly, but use an undo track.
You can navigate the command sequence to change the editing context state using -undo , -redo and -setCurrentNode: . COUndoTrack supports the same history navigation protocol than COBranch. Note that the COUndoTrack implementation (of these COTrack methods) can perform an editing context commit automatically.
You shouldn't subclass COUndoTrack.