{"modulePath":"github.com/DomBlack/git-stack","version":"v0.4.2","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package stacktest\n\nPackage stacktest provides an in-memory stack backend for tests. Branch creation and checkout happen in the real temporary repository; the graph lives in memory.\n\n## Functions\n\n```go\nfunc RestoreGraph(s stack.Snapshot) (*stack.Graph, error)\n```\nRestoreGraph is an in-memory backend's Restore: the graph SnapshotGraph copied.\n\n```go\nfunc SnapshotGraph(g *stack.Graph) (stack.Snapshot, error)\n```\nSnapshotGraph is an in-memory backend's Snapshot: a deep copy of g, as JSON, under a single key.\n\n## Types\n\n```go\ntype Backend struct {\n\n\t// Submits records submit options; SubmitFn, when set, runs on submit.\n\tSubmits  []stack.SubmitOptions\n\tSubmitFn func(o stack.SubmitOptions) error\n\t// Links records link options.\n\tLinks []stack.LinkOptions\n\n\t// Unstacked records every Unstack call; UnstackFn, when set, decides\n\t// its result.\n\tUnstacked []int\n\tUnstackFn func(number int) error\n\t// contains filtered or unexported fields\n}\n```\nBackend implements every stack port in memory.\n\n```go\nfunc New(g *git.Client, graph *stack.Graph) *Backend\n```\nNew returns a Backend over g with the given initial graph.\n\n```go\nfunc (b *Backend) AddTop(ctx context.Context, repo git.Repo, name string) error\n```\n\n```go\nfunc (b *Backend) Graph() *stack.Graph\n```\nGraph returns the current graph.\n\n```go\nfunc (b *Backend) InitStack(ctx context.Context, repo git.Repo, trunk string, branches []string) error\n```\n\n```go\nfunc (b *Backend) Link(_ context.Context, _ git.Repo, o stack.LinkOptions) (stack.SubmitResult, error)\n```\n\n```go\nfunc (b *Backend) Load(context.Context, git.Repo) (*stack.Graph, error)\n```\n\n```go\nfunc (b *Backend) Restore(_ context.Context, _ git.Repo, s stack.Snapshot) error\n```\n\n```go\nfunc (b *Backend) SetGraph(g *stack.Graph)\n```\nSetGraph replaces the graph.\n\n```go\nfunc (b *Backend) Snapshot(context.Context, git.Repo) (stack.Snapshot, error)\n```\n\n```go\nfunc (b *Backend) Submit(_ context.Context, _ git.Repo, o stack.SubmitOptions) (stack.SubmitResult, error)\n```\n\n```go\nfunc (b *Backend) Unstack(_ context.Context, _ git.Repo, number int) error\n```\n\n```go\nfunc (b *Backend) Update(_ context.Context, _ git.Repo, fn func(*stack.Graph) error) error\n```\n\n","path":"github.com/DomBlack/git-stack/pkg/stack/stacktest","name":"stacktest","synopsis":"Package stacktest provides an in-memory stack backend for tests.","isRedistributable":true}
