Documentation
¶
Overview ¶
Package restore handles snapshot restore operations.
Index ¶
- func SetHooksForTest(hooks Hooks) func()
- type Hooks
- type IncompleteError
- type PathBackupEntry
- type Restorer
- func (r *Restorer) Restore(worktreeName string, snapshotID model.SnapshotID) error
- func (r *Restorer) RestoreLocked(worktreeName string, snapshotID model.SnapshotID) error
- func (r *Restorer) RestoreLockedWithOptions(worktreeName string, snapshotID model.SnapshotID, options RunOptions) error
- func (r *Restorer) RestorePath(worktreeName string, snapshotID model.SnapshotID, path string) error
- func (r *Restorer) RestorePathLocked(worktreeName string, snapshotID model.SnapshotID, path string) error
- func (r *Restorer) RestorePathLockedWithOptions(worktreeName string, snapshotID model.SnapshotID, path string, ...) error
- func (r *Restorer) RestoreToLatest(worktreeName string) error
- type RunOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetHooksForTest ¶
func SetHooksForTest(hooks Hooks) func()
Types ¶
type IncompleteError ¶
type IncompleteError struct {
BackupPath string
PayloadRolledBack bool
PathEntries []PathBackupEntry
// contains filtered or unexported fields
}
func AsIncompleteError ¶
func AsIncompleteError(err error) (*IncompleteError, bool)
func (*IncompleteError) Error ¶
func (e *IncompleteError) Error() string
func (*IncompleteError) Unwrap ¶
func (e *IncompleteError) Unwrap() error
type PathBackupEntry ¶
type Restorer ¶
type Restorer struct {
// contains filtered or unexported fields
}
Restorer handles snapshot restore operations.
func NewRestorer ¶
func NewRestorer(repoRoot string, engineType model.EngineType) *Restorer
NewRestorer creates a new restorer.
func (*Restorer) Restore ¶
func (r *Restorer) Restore(worktreeName string, snapshotID model.SnapshotID) error
Restore replaces the content of a worktree with a snapshot. This puts the worktree into a "detached" state (unless restoring to HEAD). The worktree is specified by name, not derived from the snapshot.
func (*Restorer) RestoreLocked ¶
func (r *Restorer) RestoreLocked(worktreeName string, snapshotID model.SnapshotID) error
RestoreLocked performs Restore while the caller already holds the repository mutation lock.
func (*Restorer) RestoreLockedWithOptions ¶
func (r *Restorer) RestoreLockedWithOptions(worktreeName string, snapshotID model.SnapshotID, options RunOptions) error
func (*Restorer) RestorePath ¶
RestorePath replaces one workspace-relative file or directory from a save point without moving the workspace history or whole-workspace content source.
func (*Restorer) RestorePathLocked ¶
func (r *Restorer) RestorePathLocked(worktreeName string, snapshotID model.SnapshotID, path string) error
RestorePathLocked performs RestorePath while the caller already holds the repository mutation lock.
func (*Restorer) RestorePathLockedWithOptions ¶
func (r *Restorer) RestorePathLockedWithOptions(worktreeName string, snapshotID model.SnapshotID, path string, options RunOptions) error
func (*Restorer) RestoreToLatest ¶
RestoreToLatest restores a worktree to its latest snapshot (exits detached state).
type RunOptions ¶
type RunOptions struct {
BackupPath string
}